ci / build-and-test (push) Canceled after 0s
Run on push and pull_request to main. Steps: - pnpm install --frozen-lockfile with store cache keyed on pnpm-lock.yaml. - Playwright chromium install. - pnpm run check (typecheck via astro check). - pnpm run build (prebuild regenerates og-default.png and re-runs check). - Upload dist/ as a build artifact. - pnpm run test:e2e (pretest:e2e re-runs check + build so the preview server is always fresh). - Upload playwright-report on every run for post-mortem. Concurrency group cancels in-progress runs on the same ref.
66 lines
1.5 KiB
YAML
66 lines
1.5 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-22.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version-file: '.nvmrc'
|
|
|
|
- name: Setup pnpm cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.local/share/pnpm/store
|
|
key: pnpm-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
pnpm-${{ runner.os }}-
|
|
|
|
- name: Enable corepack
|
|
run: corepack enable
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile
|
|
|
|
- name: Install Playwright browser
|
|
run: pnpm exec playwright install --with-deps chromium
|
|
|
|
- name: Typecheck (astro check)
|
|
run: pnpm run check
|
|
|
|
- name: Build
|
|
run: pnpm run build
|
|
|
|
- name: Upload build artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
- name: End-to-end tests (Playwright + axe)
|
|
run: pnpm run test:e2e
|
|
|
|
- name: Upload Playwright report
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report
|
|
retention-days: 7
|