fix(ci): Robust E2E & Unit Test Pipeline #5
Workflow file for this run
This file contains hidden or 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: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| unit-test: | |
| name: Unit Tests (Docker) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # We don't need setup-node here because 'npm test' runs via Docker | |
| # But we need npm to run the script itself? | |
| # Actually 'npm test' is a shell command. | |
| # Wait, the runner has npm. | |
| - name: Run Unit Tests | |
| run: ./test/run-docker.sh | |
| e2e-test: | |
| name: E2E Tests (Playwright) | |
| runs-on: ubuntu-latest | |
| container: | |
| image: mcr.microsoft.com/playwright:v1.57.0-jammy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install Git | |
| run: apt-get update && apt-get install -y git | |
| - name: Configure Git User | |
| run: | | |
| git config --global user.email "ci@git-cms.local" | |
| git config --global user.name "CI Bot" | |
| git config --global init.defaultBranch main | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run Playwright Tests | |
| run: npm run test:e2e | |
| env: | |
| CI: true | |
| PORT: 4638 | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: playwright-report | |
| path: playwright-report/ | |
| retention-days: 30 |