Repository navigation
56 lines (47 loc) · 1.97 KB
/
Copy pathdashboard-check.yml
File metadata and controls
56 lines (47 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Dashboard Check (typecheck + tests)
# The device dashboard (static/dashboard) is Node + TypeScript and boots via ts-node,
# which type-checks on start — so a TS error can stop it booting. Nothing else in CI
# covers it, so type-check + unit-test it on any PR that touches it. (ADFA-4511)
on:
push:
branches: [ "main", "development" ]
paths:
- 'static/dashboard/**'
pull_request:
branches: [ "main", "development" ]
paths:
- 'static/dashboard/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Typecheck & Test
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./static/dashboard
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Node
uses: actions/setup-node@v5
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: static/dashboard/package-lock.json
# K2GO-557: better-sqlite3 must stay pinned to an exact version. A range (^ or ~) lets a
# fresh install on the box resolve a newer 12.x than the one baked into the rootfs, which
# forces a ~20-min native recompile during the live self-update instead of reusing the
# compiled better_sqlite3.node.
- name: Assert better-sqlite3 is pinned exact
run: |
node -e "const v=require('./package.json').dependencies['better-sqlite3']; if(!/^[0-9]+[.][0-9]+[.][0-9]+$/.test(v)){console.error('better-sqlite3 must be an exact version, not a range. Got '+v);process.exit(1)} console.log('better-sqlite3 pinned exact: '+v)"
# --ignore-scripts: skip the better-sqlite3 native build (not needed to type-check
# or run the maps unit tests); still installs all JS/TS deps + devDeps.
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Type-check (tsc --noEmit, strict)
run: npm run typecheck
- name: Unit tests
run: npm test