Repository navigation
69 lines (64 loc) · 2.73 KB
/
Copy pathci.yml
File metadata and controls
69 lines (64 loc) · 2.73 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
57
58
59
60
61
62
63
64
65
66
67
68
69
name: CI
on:
push:
branches: [main, "release/**"]
pull_request:
permissions:
contents: read
# Only the newest run per branch matters; cancel the rest.
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- run: npm test
- run: npm run build:all
# A regression here means the inlined worker or wasm leaked into the
# served bundle — see build/use-inline-variants.ts. The number is a leak
# tripwire, not a size budget: a leak adds hundreds of KB (the wasm alone
# is 272 KB), so the ceiling only has to sit clear of honest growth. It
# was raised from 20 KB when segmented transfers took the chunk to 22 KB
# on merit — that is what a threshold with no slack costs.
- name: Served receive chunk stays small
run: |
shopt -s nullglob
chunks=(dist/assets/receive-*.js)
# Chunking is Rollup's call, so assert the shape before measuring it:
# `stat` on a multi-file glob prints several lines and `test` then
# fails with a syntax error instead of a useful message.
if [ "${#chunks[@]}" -ne 1 ]; then
echo "expected exactly one receive chunk, found ${#chunks[@]}: ${chunks[*]:-none}"
exit 1
fi
bytes=$(stat -c%s "${chunks[0]}")
echo "receive chunk: ${chunks[0]} — $bytes bytes"
test "$bytes" -lt 40000
# rootPwaHead() in build/root-pwa-head.ts already asserts this at build
# time, but only against the HTML it rewrote. This checks the files on disk
# exist where every page now points, which is the part that broke before:
# /send/ and /receive/ asked for a manifest and an sw.js that were only
# ever at the root, so neither page registered a service worker.
- name: Every page's PWA references resolve to real files
run: |
test -f dist/manifest.webmanifest
test -f dist/sw.js
for page in index send/index receive/index; do
dir=$(dirname "dist/$page.html")
for ref in $(grep -oE '(href="[^"]*manifest\.webmanifest"|register\('"'"'[^'"'"']*sw\.js'"'"')' "dist/$page.html" \
| grep -oE '[^"'"'"'(]*(manifest\.webmanifest|sw\.js)'); do
target=$(realpath -m "$dir/$ref")
if [ ! -f "$target" ]; then
echo "dist/$page.html references $ref -> $target, which does not exist"
exit 1
fi
echo "dist/$page.html: $ref -> ${target#"$PWD/"}"
done
done