tests: e2e test for analytics #854
Workflow file for this run
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: Tests | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- ready_for_review | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
concurrency: | |
group: tests-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: devenv {0} | |
env: | |
SNAPLET_DISABLE_TELEMETRY: '1' | |
PG_TEST_DATABASE_SERVER: postgresql://postgres:postgres@localhost:5432/postgres | |
MYSQL_TEST_DATABASE_SERVER: mysql://root@localhost:3306/mysql | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | |
CI: '1' | |
jobs: | |
test-type-check: | |
if: github.event.pull_request.draft == false | |
name: Type check | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Type check | |
run: pnpm type-check | |
test-lint: | |
if: github.event.pull_request.draft == false | |
name: Lint | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Lint | |
run: pnpm lint | |
test-lint-monorepo: | |
if: github.event.pull_request.draft == false | |
name: Lint monorepo | |
runs-on: buildjet-4vcpu-ubuntu-2204 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Lint monorepo | |
run: pnpm lint-monorepo | |
test-unit-integration: | |
if: github.event.pull_request.draft == false | |
name: Unit and integration tests | |
runs-on: buildjet-32vcpu-ubuntu-2204 | |
services: | |
postgres: | |
# Custom image built with higher max_connections for vitests parralelization | |
# See docker/Dockerfile.postgres to see how it was built | |
image: avallete/postgres-custom-ci | |
credentials: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: postgres | |
mysql: | |
# Custom image built with higher timeout for vitest parralelization | |
# See docker/Dockerfile.mysql to see how it was built | |
image: avallete/mysql-custom-ci | |
credentials: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
ports: | |
- 3306:3306 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: true | |
MYSQL_DATABASE: mysql | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | |
uses: ./.github/actions/setup | |
- name: Run dev API in background | |
run: | | |
pnpm -F @snaplet/seed run start:server & | |
npx --yes wait-on -d 5000 -i 2000 -t 20000 http://localhost:3000 --log --verbose | |
- name: Run unit and integration tests | |
run: pnpm test | |
- name: Run e2e tests | |
run: pnpm test:e2e |