github: CD: Call e2e test #1071
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: 'CI' | |
on: | |
push: {} | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
NX_NO_CLOUD: ${{ vars.NX_NO_CLOUD }} | |
GITHUB_ACTIONS: true | |
jobs: | |
lint: | |
name: Lint Code | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup main branch for reference | |
if: ${{ github.ref_name != 'main' }} | |
run: git branch --track main origin/main | |
- name: Setup NX | |
uses: nrwl/nx-set-shas@v3 | |
- name: Setup PNPM package manager | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Setup the BEAM and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '26.2.2' | |
elixir-version: '1.16.1' | |
- name: Install node dependencies | |
run: pnpm install | |
- name: Lint | |
run: pnpm nx affected -t lint | |
- name: Typecheck | |
run: pnpm nx affected -t typecheck | |
tests: | |
name: Run tests | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:latest | |
ports: | |
- 5432:5432 | |
options: >- | |
-e POSTGRES_USER=lotta | |
-e POSTGRES_PASSWORD=lotta | |
rabbitmq: | |
image: rabbitmq:latest | |
ports: | |
- 5672:5672 | |
redis: | |
image: bitnami/redis:latest | |
ports: | |
- 6379:6379 | |
options: >- | |
-e REDIS_PASSWORD=lotta | |
minio: | |
image: lazybit/minio | |
ports: | |
- 9000:9000 | |
env: | |
MINIO_ACCESS_KEY: AKIAIOSFODNN7EXAMPLE | |
MINIO_SECRET_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY | |
options: >- | |
--name minio | |
--health-cmd "curl http://localhost:9000/minio/health/live" | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup minio | |
run: > | |
docker run --network host --name minio_setup --entrypoint /bin/bash minio/mc -c " | |
/usr/bin/mc alias set minio http://localhost:9000 AKIAIOSFODNN7EXAMPLE wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY; | |
/usr/bin/mc rm -r --force minio/lotta-dev-ugc; | |
/usr/bin/mc mb minio/lotta-dev-ugc; | |
/usr/bin/mc anonymous set download minio/lotta-dev-ugc; | |
exit 0; | |
" | |
- name: Setup main branch for reference | |
if: ${{ github.ref_name != 'main' }} | |
run: git branch --track main origin/main | |
- name: Setup NX | |
uses: nrwl/nx-set-shas@v3 | |
- name: Setup PNPM package manager | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Setup the BEAM and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '26.2.2' | |
elixir-version: '1.16.1' | |
- name: Install npm dependencies | |
run: pnpm install | |
- name: Run Unit / Component tests | |
run: pnpm nx affected -t test --configuration=coverage | |
env: | |
NODE_ENV: test | |
MIX_ENV: test | |
- name: Run end-to-end tests | |
run: | | |
pnpm exec playwright install --with-deps chromium | |
pnpm nx affected -t e2e --configuration=ci | |
- name: Upload Tests for storybook-addon-theme | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: libs/storybook-addon-theme/coverage/ | |
flags: storybook-addon-theme | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
- name: Upload Tests for hubert | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: libs/hubert/coverage/ | |
flags: hubert | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
- name: Upload Tests for Webapp | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: apps/webapp/coverage/ | |
flags: webapp | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
- name: Upload Tests for CoreApi | |
uses: codecov/codecov-action@v4 | |
with: | |
directory: apps/core-api/cover/ | |
flags: core-api | |
token: ${{ secrets.CODECOV_TOKEN }} | |
verbose: true | |
check-build: | |
name: Check the projects build | |
runs-on: ubuntu-latest | |
if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/') && !contains(github.event.pull_request.labels.*.name, 'preview') | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup main branch for reference | |
if: ${{ github.ref_name != 'main' }} | |
run: git branch --track main origin/main | |
- name: Setup NX | |
uses: nrwl/nx-set-shas@v3 | |
- name: Setup PNPM package manager | |
uses: pnpm/action-setup@v3 | |
with: | |
version: 8 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'pnpm' | |
- name: Setup the BEAM and Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: '26.2.2' | |
elixir-version: '1.16.1' | |
- name: Install npm dependencies | |
run: pnpm install | |
- name: Run build task | |
run: pnpm nx affected -t build |