Skip to content

GitHub Actions

GitHub Actions #36

Workflow file for this run

name: Tests
on:
pull_request:
branches:
- main
env:
VITE_API_URL: http://localhost:3000
API_SECRET: ${{ secrets.API_SECRET }}
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: quotes
DATABASE_URL: postgres://postgres:${{ secrets.POSTGRES_PASSWORD }}@localhost:5432/quotes
CI: 1
jobs:
unit-and-integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- name: Run unit tests
run: pnpm test:backend:unit
- uses: ./.github/actions/docker-compose
- name: Run integration tests
run: pnpm test:backend:int
e2e-tests:
runs-on: ubuntu-latest
container: mcr.microsoft.com/playwright:v1.37.0-jammy
strategy:
fail-fast: false
matrix:
shard: [1/4, 2/4, 3/4, 4/4]
services:
postgres:
image: postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_DB: quotes
options: >-
--health-cmd pg_isready
--health-interval 1s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
# - uses: ./.github/actions/build
- uses: ./.github/actions/install-deps
# - uses: ./.github/actions/docker-compose
# - uses: ./.github/actions/playwright
- name: Run e2e tests
run: npx playwright test --shard=${{ matrix.shard }}
working-directory: e2e
- uses: actions/upload-artifact@v3
if: always()
with:
name: all-blob-reports
path: e2e/blob-report
retention-days: 3
merge-e2e-reports:
runs-on: ubuntu-latest
if: always()
needs: [e2e-tests]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/build
- uses: actions/download-artifact@v3
with:
name: all-blob-reports
path: e2e/all-blob-reports
- name: Merge Reports
run: npx playwright merge-reports --reporter=html,github ./all-blob-reports
working-directory: e2e
- name: Upload Merged Reports
uses: actions/upload-artifact@v3
with:
name: merged-report-attempt-${{ github.run_attempt }}
path: e2e/playwright-report
retention-days: 3