tests and eurc
All checks were successful
Deploy / build-deploy (push) Successful in 4m19s

This commit is contained in:
Jorijn van der Graaf 2026-08-15 00:54:05 +02:00
commit 749f525f83
44 changed files with 5380 additions and 3532 deletions

View file

@ -31,9 +31,10 @@ jobs:
# the pixel dimensions of each mirrored file, which become the
# width/height attributes that stop the posts page reflowing as 5 MB
# recordings arrive. ffmpeg transcodes each still image into the AVIF
# and PNG renditions the page serves it between. tools/e2e.sh asserts
# both are present — so without this package the deploy fails at the
# e2e gate rather than shipping a janky page.
# and PNG renditions the page serves it between. The
# ShouldServePostPages suite asserts both are present — so without
# this package the deploy fails at the test gate rather than
# shipping a janky page.
pacman -Syu --noconfirm --needed \
nodejs \
clang lld libc++ \
@ -121,24 +122,37 @@ jobs:
dir=media
fi
tools/fetch-media.sh "$dir"
# Handed to the e2e step so it checks the files where they actually
# are. It used to assume ./media and reported every referenced file
# as missing here, which reads as a broken site and means a wrong path.
# Handed to the test step (E2E_MEDIA_DIR) so ShouldServePostPages
# checks the files where they actually are. It used to assume
# ./media and reported every referenced file as missing here, which
# reads as a broken site and means a wrong path.
echo "dir=$dir" >> "$GITHUB_OUTPUT"
- name: Build and test the backend
id: srv
# The server product builds Catcrafts.Shared for the host, which is the
# only way to actually RUN the code that generates every byte of markup
# the site emits. --selftest is a gate: if escaping or the JSON reader
# regress, the deploy stops here rather than shipping broken pages.
# the site emits. `crafter-build test` is the gate: if escaping or the
# JSON reader regress, the deploy stops here rather than shipping
# broken pages. One suite per tests/<Name>/main.cpp — the unit suites
# replaced the binary's --selftest flag, the Should{ServeRoutes,…}
# black-box suites replaced tools/e2e.sh: each spawns the freshly
# built server on its own scratch port with the fake payment rails and
# exercises it over real HTTP. ShouldBootWasmAtDepth self-skips here —
# no wasm bundle exists yet — and re-runs after the wasm build below.
#
# E2E_MEDIA_DIR points ShouldServePostPages at the mirror mount, where
# the media files actually are.
#
# Same refuse-to-guess rule as the wasm bundle below: a variant
# directory embeds a config hash, so more than one match means the tree
# is ambiguous and picking the first would deploy an arbitrary build.
env:
E2E_MEDIA_DIR: ${{ steps.media.outputs.dir }}
run: |
set -eux
crafter-build -- --product=server
crafter-build --product=server
crafter-build test --product=server
matches=$(find bin -maxdepth 1 -type d -name 'Catcrafts.Server-*' | sort)
count=$(printf '%s\n' "$matches" | grep -c . || true)
if [ "$count" -ne 1 ]; then
@ -147,7 +161,6 @@ jobs:
exit 1
fi
echo "srv=$matches" >> "$GITHUB_OUTPUT"
"$matches/catcrafts-server" --selftest
"$matches/catcrafts-server" --routes
- name: Generate sitemap and Atom feed
@ -204,26 +217,18 @@ jobs:
DIST: ${{ steps.out.outputs.dist }}
run: tools/fix-bundle-depth.sh "$DIST"
- name: End-to-end HTTP tests
# Starts the freshly built server on a scratch port and exercises it over
# real HTTP: status codes, redirects, headers, form submission, and the
# no-JavaScript guarantee. --selftest covers the pure functions; only a
# real request can show that /nope is a 404 rather than a soft 404, that
# /projects contains its content with no <script> at all, and that a
# rejected form comes back with the visitor's values still in it.
#
# Runs AFTER the wasm build, which is not cosmetic ordering. The server
# discovers the bundle under bin/ and lifts its <script> tags from it, so
# with no bundle present there is nothing to assert about wasm booting:
# "/demos/raytracer loads the wasm" fails outright, and every
# "ships no script" check passes vacuously because no page has scripts to
# begin with. Building first is what makes both meaningful.
- name: Wasm boot and script-shape checks
# The bundle-sensitive slice of the black-box suites, re-run now that
# the wasm bundle exists under bin/. The server discovers the bundle
# and lifts its <script> tags from it, so before the wasm build there
# is nothing to assert about wasm booting: ShouldBootWasmAtDepth
# self-skipped in the backend step, and ShouldStayScriptFree's checks
# around the boot tags passed vacuously because no page had scripts to
# begin with. Re-running both against the real bundle is what makes
# them meaningful.
#
# A gate, not a report: a failure here stops the deploy.
env:
SRV: ${{ steps.srv.outputs.srv }}
E2E_MEDIA_DIR: ${{ steps.media.outputs.dir }}
run: tools/e2e.sh "$SRV/catcrafts-server"
run: crafter-build test ShouldBootWasmAtDepth ShouldStayScriptFree --product=server
- name: Pre-compress static assets
# Caddy's `precompressed zstd gzip` (see deploy/Caddyfile.example)
@ -303,7 +308,7 @@ jobs:
# runner, or a polkit rule) grant CI far more than "restart one service"
# needs. Instead the last step touches a marker file that
# catcrafts-deploy.path watches — see deploy/catcrafts-deploy.path.
# That unit re-runs --selftest against the new binary before cutting
# That unit smoke-checks the new binary (--render /) before cutting
# over, so a broken deploy leaves the working server running.
env:
SRV: ${{ steps.srv.outputs.srv }}