Stop tracking machine-local editor configuration #18
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: | |
| workflow_dispatch: | |
| # A new push to a PR makes the in-flight run irrelevant. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| NODE_VERSION: '22.x' | |
| jobs: | |
| verify: | |
| name: Types, lint, unit (Node ${{ matrix.node }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Lowest supported version and the version the project is developed | |
| # on. They ship different npm majors, which resolve the lockfile | |
| # differently, so testing both stops a lockfile that installs under | |
| # only one of them from being committed. | |
| node: ['22.12', '26.x'] | |
| # 22.12 is the real floor: vitest 4 builds on rolldown, whose native | |
| # bindings declare engines ^20.19.0 || >=22.12.0. Below that npm skips | |
| # them as incompatible optional dependencies and the suite dies on a | |
| # missing binding rather than on anything the project controls. | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run typecheck | |
| - run: npm run lint | |
| - run: npm run test | |
| integration: | |
| name: Integration tests | |
| runs-on: ubuntu-latest | |
| env: | |
| DATABASE_URL: postgresql://draftledger:draftledger@localhost:5432/draftledger_test | |
| services: | |
| postgres: | |
| image: postgres:17-alpine | |
| env: | |
| POSTGRES_USER: draftledger | |
| POSTGRES_PASSWORD: draftledger | |
| POSTGRES_DB: draftledger_test | |
| ports: ['5432:5432'] | |
| options: >- | |
| --health-cmd "pg_isready -U draftledger" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run db:migrate | |
| - run: npm run db:seed | |
| - run: npm run test:integration | |
| e2e: | |
| name: End-to-end tests | |
| runs-on: ubuntu-latest | |
| env: | |
| DATABASE_URL: postgresql://draftledger:draftledger@localhost:5432/draftledger_test | |
| services: | |
| postgres: | |
| image: postgres:17-alpine | |
| env: | |
| POSTGRES_USER: draftledger | |
| POSTGRES_PASSWORD: draftledger | |
| POSTGRES_DB: draftledger_test | |
| ports: ['5432:5432'] | |
| options: >- | |
| --health-cmd "pg_isready -U draftledger" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 10 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: npm | |
| - run: npm ci | |
| - run: npx playwright install --with-deps chromium | |
| - run: npm run db:migrate | |
| - run: npm run db:seed | |
| # playwright.config.ts builds and starts the app itself via `webServer`. | |
| - run: npm run test:e2e | |
| - uses: actions/upload-artifact@v4 | |
| if: failure() | |
| with: | |
| name: playwright-report | |
| path: | | |
| playwright-report/ | |
| test-results/ | |
| retention-days: 7 | |
| docker: | |
| name: Docker image builds | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: docker/setup-buildx-action@v4 | |
| - uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: false | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |