Repository navigation
ci: add test, build and locale-parity checks - #15
Merged
Merged
Conversation
Adds a GitHub Actions workflow so regressions are caught on pull requests instead of at release time. Jobs: - Test: npm ci + npm test. Skips cleanly when package.json has no "test" script yet, so the workflow is usable before the first suite lands. - Build assets: installs Bun (build.js shells out to it for the Tailwind CLI step), runs node build.js, then scripts/check-assets.js. - Locale parity: scripts/check-locales.js. Two helper scripts, runnable locally: - scripts/check-locales.js verifies every locale has exactly the same key set as en.json and that top-level keys stay sorted A-Z. build.js only re-sorts a file when its keys change, so an unsorted file would otherwise persist forever. - scripts/check-assets.js verifies every generated asset referenced by a template was actually produced by the build. Only build outputs (*.min.js, *.min.css, *.min.json, tailwind.css) are asserted; committed sources are skipped. Also sorts static/locales/vi.json, the only locale whose top-level keys were not A-Z. Content is unchanged (verified by deep comparison); the diff is a pure reorder.
bun.lock was gitignored, so every install resolved dependencies fresh. CI
(and any fresh clone) therefore pulled @fortawesome/fontawesome-free 7.3.1
instead of the 7.2.0 this tree was built against.
7.3.1 no longer ships the webfonts/ directory, so the CSS build emitted no
font files and web/static/webfonts/ was never created. That broke the
backend, which go:embed's that path:
main.go:53:29: pattern web/static/webfonts: no matching files found
The failure surfaced in the Go build, pointing at Go rather than at the
frontend dependency bump — which is what made it worth fixing properly
instead of papering over.
Changes:
- Commit bun.lock (26 KB) and drop it from .gitignore.
- build-frontend.sh / .bat / .ps1 use `bun install --frozen-lockfile`,
falling back to an unpinned install with a warning if the lockfile is
absent.
- The CI build job gains a "Verify go:embed prerequisites" step asserting
every path main.go embeds still exists after a build, with an error that
names the likely cause. This catches the same class of breakage in the
frontend repo, where it can actually be understood.
- CI jobs now install with bun + --frozen-lockfile rather than npm, so the
lockfile that pins the build is the one that is used.
Verified: a clean `bun install --frozen-lockfile` resolves Font Awesome
7.2.0 with 4 woff2 files, the build recreates static/webfonts/, and the
backend then passes `go vet ./...` and `go build`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds CI so regressions are caught on pull requests instead of at release time. The frontend repo currently has no workflow at all.
Jobs
npm ci+npm test. Skips cleanly whenpackage.jsonhas notestscript yet, so this workflow is usable before #14 lands.build.jsshells out to it for the Tailwind CLI step), runsnode build.js, thenscripts/check-assets.js.scripts/check-locales.js.build.jscallsexecFile('bun', ...)for Tailwind, so the build job installs Bun viaoven-sh/setup-bun@v2. Without it the job would fail on the runner.Helper scripts (runnable locally)
scripts/check-locales.js— every locale must have exactly the same key set asen.json, and top-level keys must stay sorted A-Z.This matters because
build.jsonly re-sorts a locale file when its keys change (if (addedKeys.length > 0 || removedKeys.length > 0)). A file that drifts out of order without a key change stays unsorted forever.scripts/check-assets.js— every generated asset referenced by a template must exist after a build. Only build outputs (*.min.js,*.min.css,*.min.json,tailwind.css) are asserted; committed sources are skipped.This catches a real class of bug: adding
<script src="/static/js/foo.min.js">to a template without the build producing it — which would be a silent 404 in production, invisible until someone opens devtools.Both print GitHub
::error file=...::messageannotations, so failures point at the exact file in the PR diff.Also fixes an existing issue
static/locales/vi.jsonwas the only locale whose top-level keys were not sorted A-Z (child_toggle_notebeforechild_modal_warning,copybeforecopied). Sorted here so the new check passes from day one.The diff is a pure reorder — verified by deep comparison that the parsed content is byte-for-byte identical, 706 keys before and after.
Verification
All three jobs run green locally:
Each check was also probed by deliberately breaking things, to confirm it fails when it should:
ja.jsonghost.min.jskm.jsonNot covered
build.js), so it needs network; it does not verify a checksum of those downloads. Worth pinning a SHA-256 later, mirroring what the backendDockerfilealready does for yt-dlp.