CI starts postgres:16-alpine and the sync server before npm test, so the round-trip runs for real instead of skipping. A fake would not exercise the change_seq trigger, the last-write-wins upsert or cursor paging, which is exactly where sync goes wrong. Also corrects the stale advisory count in the validate.mjs comment: the updated export bundle carries data/gloss-extra.json, and the baseline has been 0 blocking, 0 advisory since it landed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
69 lines
1.9 KiB
YAML
69 lines
1.9 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# The curriculum gate comes first, before anything else can run.
|
|
# validate.mjs reads only data/ and lib/ and exits non-zero on a
|
|
# blocking failure. Baseline: PASS — 0 blocking, 0 advisory.
|
|
- name: Curriculum validation
|
|
run: node validate.mjs
|
|
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 22
|
|
cache: npm
|
|
|
|
- run: npm ci
|
|
|
|
- name: Typecheck
|
|
run: npm run typecheck
|
|
|
|
# The sync round-trip needs a real Postgres and a running server, so a
|
|
# fake would not exercise the change_seq trigger, the last-write-wins
|
|
# upsert, or cursor paging — which is where sync actually goes wrong.
|
|
- name: Start Postgres
|
|
run: |
|
|
docker run -d --name hankan-pg \
|
|
-e POSTGRES_PASSWORD=test -e POSTGRES_DB=hankan \
|
|
-p 55432:5432 postgres:16-alpine
|
|
for i in $(seq 1 30); do
|
|
docker exec hankan-pg pg_isready -U postgres -d hankan && break
|
|
sleep 1
|
|
done
|
|
|
|
- name: Start the sync server
|
|
env:
|
|
DATABASE_URL: postgres://postgres:test@localhost:55432/hankan
|
|
HANKAN_TOKEN: test-token
|
|
HANKAN_TEST_MODE: "1"
|
|
PORT: "8788"
|
|
run: |
|
|
node --experimental-strip-types server/src/main.ts &
|
|
for i in $(seq 1 30); do
|
|
curl -sf http://localhost:8788/health && break
|
|
sleep 1
|
|
done
|
|
|
|
- name: Tests
|
|
env:
|
|
HANKAN_TEST_SERVER: http://localhost:8788
|
|
run: npm test
|
|
|
|
# Every word in every unit's words[] must resolve in lemma or surface.
|
|
# Runs against the committed band files in app/public/dict/.
|
|
- name: Roadmap word coverage
|
|
run: npm run dict:assert
|
|
|
|
- name: Build
|
|
run: npm run build
|