Skip to main content

continuous integration

To guarantee the stability of your app, we recommend that you run pr checks using github actions to:

  • run build on your app
  • run eslint on your app
  • run build on your client applications
  • run unit specs
  • run feature specs

Here is an example of how to achieve this using github actions:

# .github/workflows/pr-checks.yml
name: PR Checks
on:
- pull_request

env:
NODE_ENV: test
PNPM_CACHE_FOLDER: ~/.pnpm-cache
PORT: 7778
CORS_HOSTS: '["http://localhost:3000"]'
DB_USER: myapp
DB_NAME: myapp
DB_HOST: localhost
DB_PASSWORD: postgres
DB_PORT: 5432
PUPPETEER_SKIP_DOWNLOAD: true
CHROME_PATH: /usr/bin/google-chrome

jobs:
uspec:
name: Unit tests
strategy:
# uncomment to parallelize
# matrix:
# shard: [1, 2, 3, 4, 5]
fail-fast: false
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: myapp
POSTGRES_DB: myapp
POSTGRES_PASSWORD: 'postgres'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7.0
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
defaults:
run:
working-directory: ./api
env:
# we recommend you set this to the number of cores on your CI runner
DREAM_PARALLEL_TESTS: 4
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'

- run: corepack enable

- run: pnpm install --frozen-lockfile
- run: pnpm psy db:migrate --skip-sync
- run: pnpm uspec --shard=${{ matrix.shard }}/${{ strategy.job-total }}

fspec:
name: Feature tests
strategy:
# uncomment for parallelism
# matrix:
# shard: [1, 2, 3, 4, 5]
fail-fast: false
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: welloscentral
POSTGRES_DB: wellos_central_test
POSTGRES_PASSWORD: 'postgres'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7.0
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
defaults:
run:
working-directory: ./api

env:
DISABLE_ESLINT_PLUGIN: true
ESLINT_NO_DEV_ERRORS: true

steps:
- uses: actions/checkout@v4
- run: corepack enable

- run: pnpm install --frozen-lockfile

- run: pnpm install --frozen-lockfile
working-directory: ./client

- run: mkdir -p /tmp/screenshots
- run: pnpm psy db:migrate --skip-sync
- run: pnpm fspec --shard=${{ matrix.shard }}/${{ strategy.job-total }}

- name: Archive screenshots
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: Feature spec screenshots
path: /tmp/screenshots

lint:
name: Linting
runs-on: Wellos
defaults:
run:
working-directory: ./api
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'

- run: corepack enable

- run: pnpm install --frozen-lockfile
- run: pnpm lint

check-build:
name: Check build
runs-on: Wellos
defaults:
run:
working-directory: ./api
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'

- run: corepack enable

- run: pnpm install --frozen-lockfile
- run: pnpm build

check-admin-build:
name: Check admin build
runs-on: Wellos
defaults:
run:
working-directory: ./client
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24'

- run: corepack enable

- run: pnpm install --frozen-lockfile
- run: pnpm build