mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-16 02:22:17 +00:00
2766e5ea67
DEPLOY_TARGET now selects the adapter; Netlify stays the default and NODE_ADAPTER keeps working. Cloudflare compresses in transit, so the Worker build aliases $lib/server/compression to a pass-through that leaves the streaming body alone. CI builds and dry-run deploys this target. That is compilation and packaging coverage only, not a production compatibility gate: native sharp still blocks the share-preview route in the Worker runtime.
164 lines
4.8 KiB
YAML
164 lines
4.8 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [master]
|
|
|
|
concurrency:
|
|
group: tests-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
# `$env/static/public` is resolved at build time, so every variable imported from it must be
|
|
# present for `vite build` and `svelte-check` to succeed on a clean checkout. These are the
|
|
# local-stack defaults already published in .env.local.example - never real credentials.
|
|
env:
|
|
PUBLIC_USE_LOCAL_POKEMON_SPRITE_FOLDER: 'false'
|
|
PUBLIC_SUPABASE_URL: http://127.0.0.1:54321
|
|
PUBLIC_SUPABASE_ANON_KEY: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
|
|
|
|
jobs:
|
|
quality:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- name: Check committed whitespace
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
git diff --check "${{ github.event.pull_request.base.sha }}...HEAD"
|
|
else
|
|
git diff --check "HEAD^...HEAD"
|
|
fi
|
|
- run: npm run check
|
|
- run: npm run lint
|
|
- run: npm run test:fast
|
|
- name: Verify tests leave the checkout clean
|
|
run: test -z "$(git status --porcelain --untracked-files=all)"
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: coverage
|
|
path: coverage/
|
|
if-no-files-found: ignore
|
|
|
|
integration:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
# `supabase start` applies migrations and seeds; no separate reset is needed.
|
|
- run: npx supabase start
|
|
- run: npm run test:integration
|
|
- if: always()
|
|
run: npx supabase stop
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run test:build
|
|
|
|
lighthouse:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
form-factor: [mobile, desktop]
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
# The homepage streams public stats from the database, so audit against a real stack.
|
|
- run: npx supabase start
|
|
- run: npm run test:lighthouse
|
|
# Not LHCI_*: lhci reads any LHCI_ variable as a CLI flag (LHCI_PRESET became `--preset`).
|
|
env:
|
|
LIGHTHOUSE_FORM_FACTOR: ${{ matrix.form-factor }}
|
|
- uses: actions/upload-artifact@v6
|
|
if: always()
|
|
with:
|
|
name: lighthouse-${{ matrix.form-factor }}
|
|
path: .lighthouseci/
|
|
# upload-artifact v4+ skips dot-directories unless told otherwise.
|
|
include-hidden-files: true
|
|
if-no-files-found: ignore
|
|
- if: always()
|
|
run: npx supabase stop
|
|
|
|
bdd:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
# Serve the committed sprites so offline sync doesn't download every Living Dex sprite from
|
|
# GitHub on each run.
|
|
env:
|
|
PUBLIC_USE_LOCAL_POKEMON_SPRITE_FOLDER: 'true'
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- uses: actions/cache@v5
|
|
with:
|
|
path: ~/.cache/ms-playwright
|
|
key: playwright-chromium-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
|
|
restore-keys: |
|
|
playwright-chromium-${{ runner.os }}-
|
|
- run: npx playwright install --with-deps chromium
|
|
- run: npx supabase start
|
|
- run: npm run test:bdd
|
|
- uses: actions/upload-artifact@v6
|
|
if: failure()
|
|
with:
|
|
name: playwright-failures
|
|
path: |
|
|
test-results/
|
|
playwright-report/
|
|
if-no-files-found: ignore
|
|
- if: always()
|
|
run: npx supabase stop
|
|
|
|
cloudflare-preview-build:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
env:
|
|
WRANGLER_SEND_METRICS: 'false'
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 24
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run build:cloudflare
|
|
- run: npm run check:cloudflare
|
|
# This is compilation/package coverage, not a production compatibility gate.
|
|
# Native sharp still blocks the share-preview route in the Worker runtime.
|