mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-09-14 17:42:17 +00:00
112 lines
3.1 KiB
YAML
112 lines
3.1 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: 22
|
|
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: 22
|
|
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: 22
|
|
cache: npm
|
|
- run: npm ci
|
|
- run: npm run test:build
|
|
|
|
bdd:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 30
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version: 22
|
|
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
|