Files
Spoolman/lefthook.yml
T
Donkie 708af05ab2 ci: run the client_v2 unit tests
The ci hook lints, formats and type checks client_v2 but never ran its unit
tests, so everything under src/**/*.test.ts was local only and nothing would
have caught a broken one. The backend group already runs pytest here, so this
is just the missing counterpart. The browser suite in tests_frontend_v2/ is
unaffected, it covers different ground and runs in its own job.

Adds about 4s to the style job, which already installs client_v2 deps. Left
out of pre-commit so committing stays fast.

Also points the type check comment at the pre-commit copy it meant, rather
than at itself.
2026-08-02 14:59:38 +02:00

90 lines
3.8 KiB
YAML

pre-commit:
parallel: true
jobs:
- group: # Backend checks
parallel: false
jobs:
- name: Run lint check on backend files
run: uv run ruff check --fix .
stage_fixed: true
- name: Run format check on backend files
run: uv run ruff format .
stage_fixed: true
- name: Check UV lockfile consistency
run: uv lock --check
- group: # Client checks
parallel: false
jobs:
- name: Run lint check on client files
root: "client/"
run: ./node_modules/.bin/eslint --fix . # Hardcoded path because Windows messes up if we use npx
stage_fixed: true
- name: Run format check on client files
root: "client/"
run: ./node_modules/.bin/prettier --write .
stage_fixed: true
- group: # Client v2 checks
parallel: false
jobs:
- name: Run lint check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/eslint --fix . # Hardcoded path because Windows messes up if we use npx
stage_fixed: true
- name: Run format check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/prettier --write .
stage_fixed: true
- name: Run type check on client_v2 files
root: "client_v2/"
# Both prerequisites are gitignored generated code, absent on a fresh
# clone: paraglide compiles $lib/paraglide (normally done by the vite
# plugin, so a non-build check never triggers it), and svelte-kit sync
# generates .svelte-kit/tsconfig.json. npm run keeps the paraglide
# flags in package.json only, so they can't drift from vite.config.ts.
run: npm run paraglide && ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json
# Same as pre-commit but no fixes
ci:
parallel: true
jobs:
- group: # Backend checks
parallel: false
jobs:
- name: Run lint check on backend files
run: uv run ruff check .
- name: Run format check on backend files
run: uv run ruff format --check .
- name: Check UV lockfile consistency
run: uv lock --check
- name: Run backend unit tests
run: uv run pytest tests
- group: # Client checks
parallel: false
jobs:
- name: Run lint check on client files
root: "client/"
run: ./node_modules/.bin/eslint . # Hardcoded path because Windows messes up if we use npx
- name: Run format check on client files
root: "client/"
run: ./node_modules/.bin/prettier --check .
- group: # Client v2 checks
parallel: false
jobs:
- name: Run lint check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/eslint . # Hardcoded path because Windows messes up if we use npx
- name: Run format check on client_v2 files
root: "client_v2/"
run: ./node_modules/.bin/prettier --check .
- name: Run type check on client_v2 files
root: "client_v2/"
# See the pre-commit copy of this job for why paraglide runs first.
run: npm run paraglide && ./node_modules/.bin/svelte-kit sync && ./node_modules/.bin/svelte-check --tsconfig ./tsconfig.json
- name: Run unit tests on client_v2 files
root: "client_v2/"
# Mirrors the backend's pytest job above. Kept to the ci hook only, so
# committing stays fast; these are pure unit tests over src/**/*.test.ts,
# not the browser suite in tests_frontend_v2/.
run: ./node_modules/.bin/vitest run