mirror of
https://github.com/bretzel-app/crumbs.git
synced 2026-10-12 20:06:57 +02:00
A push to a claude/** branch with an open PR triggered both the push and pull_request events. The concurrency group keys on github.ref, which differs between the two (refs/heads/... vs refs/pull/N/merge), so neither run was cancelled and the whole pipeline (including E2E) ran twice. Drop claude/** from the push trigger; branch work is now validated once via the pull_request event.
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.58.0-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
|