forked from mirror/crumbs-original
The @playwright/test npm package was bumped to ^1.62.1 during an earlier dependency-vulnerability pass, but the CI container image stayed pinned to v1.58.0-noble — Playwright requires the container's bundled browser binaries to exactly match the npm package's version, so e2e jobs have been failing with "Executable doesn't exist" ever since that bump landed on main, unrelated to any feature branch's own changes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
130 lines
2.9 KiB
YAML
130 lines
2.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_call:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
lint-and-check:
|
|
name: Lint & Type Check
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm check
|
|
|
|
unit-tests:
|
|
name: Unit Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm test:unit:coverage
|
|
|
|
- name: Coverage summary
|
|
if: always()
|
|
run: bash scripts/coverage-summary.sh "Unit Test Coverage" coverage/unit/coverage-summary.json
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: unit-coverage
|
|
path: coverage/unit/
|
|
retention-days: 14
|
|
|
|
e2e-tests:
|
|
name: E2E Tests
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: mcr.microsoft.com/playwright:v1.62.1-noble
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- uses: pnpm/action-setup@v4
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
- name: Build (with coverage instrumentation)
|
|
run: pnpm build
|
|
env:
|
|
DATABASE_URL: ./data/test-crumbs.db
|
|
NODE_ENV: test
|
|
VITE_COVERAGE: 'true'
|
|
|
|
- run: pnpm test:e2e
|
|
env:
|
|
CI: true
|
|
VITE_COVERAGE: 'true'
|
|
HOME: /root
|
|
|
|
- name: Merge E2E coverage
|
|
if: always()
|
|
run: npx nyc report
|
|
|
|
- name: Coverage summary
|
|
if: always()
|
|
run: bash scripts/coverage-summary.sh "E2E Test Coverage" coverage/e2e/coverage-summary.json
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: playwright-report
|
|
path: |
|
|
playwright-report/
|
|
test-results/
|
|
retention-days: 7
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
if: always()
|
|
with:
|
|
name: e2e-coverage
|
|
path: coverage/e2e/
|
|
retention-days: 14
|
|
|
|
docker-build:
|
|
name: Docker Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: false
|
|
provenance: false
|
|
tags: crumbs:ci
|
|
cache-from: type=gha,scope=ci-docker
|
|
cache-to: type=gha,scope=ci-docker,mode=max
|