Skip to content

conscript&web: add support for dsl resources #1142

conscript&web: add support for dsl resources

conscript&web: add support for dsl resources #1142

Workflow file for this run

name: CI/CD
on: [push]
jobs:
test:
name: "Test"
runs-on: "ubuntu-latest"
services:
postgres:
image: postgres:12.3
env:
POSTGRES_USER: congame
POSTGRES_PASSWORD: congame
POSTGRES_DB: congame
ports:
# will assign a random free host port
- 5432/tcp
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Checkout (+ fetch lfs)
uses: actions/checkout@master
with:
lfs: true # Does not checkout the files, only fetches them
- name: Checkout lfs objects
run: git lfs checkout
- name: Cache Racket dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/racket
~/.local/share/racket
key: ${{ runner.os }}-${{ hashFiles('**/info.rkt') }}-${{ hashFiles('ci/setup-catalogs.sh') }}
- name: Install Racket
uses: Bogdanp/[email protected]
with:
architecture: 'x64'
distribution: 'full'
variant: 'CS'
version: '8.11'
- name: Install Racket deps
run: |
./ci/setup-catalogs.sh
raco pkg install -D --auto --skip-installed \
congame-core/ \
conscript/ \
congame-example-study/ \
congame-identity/ \
studies/ \
congame-pjb-studies/ \
congame-price-lists/ \
congame-smtp-proxy/ \
congame-tests/ \
congame-web/
raco setup --pkgs \
congame-core \
conscript \
congame-example-study \
congame-identity \
studies \
congame-pjb-studies \
congame-price-lists \
congame-smtp-proxy \
congame-tests \
congame-web
- name: Run tests
run: ./bin/run-tests.sh
env:
CONGAME_WEB_TEST_DB_HOST: 127.0.0.1
CONGAME_WEB_TEST_DB_PORT: ${{ job.services.postgres.ports[5432] }} # get randomly assigned published port
CONGAME_WEB_TEST_DB_NAME: congame
CONGAME_WEB_TEST_DB_USERNAME: congame
CONGAME_WEB_TEST_DB_PASSWORD: congame
if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }}
build:
name: "Build"
runs-on: "ubuntu-latest"
steps:
- name: Checkout (+ fetch lfs)
uses: actions/checkout@master
with:
lfs: true # Does not checkout the files, only fetches them
- name: Checkout lfs objects
run: git lfs checkout
- name: Cache npm
uses: actions/cache@v2
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-${{ hashFiles('package-lock.json') }}
- name: Cache Racket dependencies
uses: actions/cache@v2
with:
path: |
~/.cache/racket
~/.local/share/racket
key: ${{ runner.os }}-${{ hashFiles('**/info.rkt') }}-${{ hashFiles('ci/setup-catalogs.sh') }}
- name: Install Racket
uses: Bogdanp/[email protected]
with:
architecture: 'x64'
distribution: 'full'
variant: 'CS'
version: '8.11'
- name: Install Racket deps
run: |
./ci/setup-catalogs.sh
raco pkg install -D --auto --skip-installed \
congame-core/ \
conscript/ \
congame-example-study/ \
congame-identity/ \
studies/ \
congame-pjb-studies/ \
congame-price-lists/ \
congame-smtp-proxy/ \
congame-tests/ \
congame-web/
raco setup --pkgs \
congame-core \
conscript \
congame-example-study \
congame-identity \
studies \
congame-pjb-studies \
congame-price-lists \
congame-smtp-proxy \
congame-tests \
congame-web
- name: Install Node
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Node packages
run: npm install
- name: Build Node assets
run: npm run build
- name: Build executables
run: |
raco scribble +m --htmls --dest doc --redirect 'https://docs.racket-lang.org/local-redirect/index.html' congame-doc/congame.scrbl
mkdir build
raco koyo dist -t build/identity ++lang north congame-identity/dynamic.rkt
raco koyo dist -t build/smtp-proxy congame-smtp-proxy/main.rkt
raco koyo dist \
-t build/web \
++lang conscript \
++lib conscript/survey-tools \
++lang north \
congame-web/dynamic.rkt
- name: Log into GHCR
run: |
echo "$PAT" | docker login ghcr.io -u MarcKaufmann --password-stdin
env:
PAT: ${{ secrets.PAT }}
- name: Build docker images
run: |
docker build -t "ghcr.io/marckaufmann/congame-docs:$GITHUB_SHA" -f Dockerfile.docs .
docker build -t "ghcr.io/marckaufmann/congame-identity:$GITHUB_SHA" -f Dockerfile.identity .
docker build -t "ghcr.io/marckaufmann/congame-smtp-proxy:$GITHUB_SHA" -f Dockerfile.smtp-proxy .
docker build -t "ghcr.io/marckaufmann/congame-web:$GITHUB_SHA" -f Dockerfile.web .
- name: Push docker images
run: |
docker push "ghcr.io/marckaufmann/congame-docs:$GITHUB_SHA"
docker push "ghcr.io/marckaufmann/congame-identity:$GITHUB_SHA"
docker push "ghcr.io/marckaufmann/congame-smtp-proxy:$GITHUB_SHA"
docker push "ghcr.io/marckaufmann/congame-web:$GITHUB_SHA"
deploy:
name: "Deploy"
needs: [test, build]
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@master
- name: Deploy staging
run: ./ci/deploy.sh STAGING
env:
PAT: ${{ secrets.PAT }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
POSTMARK_TOKEN: ${{ secrets.POSTMARK_TOKEN }}
SENTRY_DSN : ${{ secrets.SENTRY_DSN }}
if: >-
startsWith(github.ref, 'refs/heads/master')
- name: Deploy production
run: ./ci/deploy.sh PRODUCTION
env:
PAT: ${{ secrets.PAT }}
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
POSTMARK_TOKEN: ${{ secrets.POSTMARK_TOKEN }}
SENTRY_DSN : ${{ secrets.SENTRY_DSN }}
if: >-
startsWith(github.ref, 'refs/tags/v')