ci: check runs as five parts on five runners, from one definition

The check job took 72 minutes on one runner for 0ef1ef2c2 (56 of them
tests, one binary at a time: the viewer's read_only.rs 901 s, its unit
tests 759 s, hostile_args.rs 294 s), so a red test was more than an hour
away and a morning of pushes queued behind each other.

`just check` is now a list of parts (lint, gui-unit, gui-tests, cli,
rest), each one `just check-shard <part>`. A laptop runs them in order;
CI runs each on its own runner. One definition serves both, so what CI
checks is what `just check` checks. Nothing can fall out of it:
- `rest` is the workspace less the crates another part names, so a new
  crate is tested without being added to a list;
- the viewer's two parts are every target `cargo test -p ledger-gui`
  runs (library, executable, each tests/ file, doc tests);
- the lint part fails unless check.yml's list of parts is the justfile's.
The parity floor's comparison runs once, in the lint part.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude committed 2026-11-09 17:29:42 -07:00
1 parent abafa94a53
commit 5544a3e66f
2 files changed
+70 -8

No files matched your search

+15 -2
View File
@@ -1,5 +1,10 @@
# Every change: format, clippy and rustdoc with zero warnings, every test.
# Tools come from mise.toml, the same as on a laptop.
#
# `just check` is cut into parts (the justfile's check_shards), one runner
# each, side by side: on one runner the job took 72 minutes on 2026-11-09,
# and a red test was an hour away. The list below must be the justfile's
# (the lint part checks that), so no part can be left out here unseen.
name: check
on:
push:
@@ -15,7 +20,14 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
check:
name: check (${{ matrix.shard }})
runs-on: ubuntu-24.04
timeout-minutes: 75
strategy:
# One red part does not stop the others: the run lists every failure.
fail-fast: false
matrix:
shard: [lint, gui-unit, gui-tests, cli, rest]
# The runner's disk is small (the first run after P6 landed died in
# the linker: "No space left on device", ld killed by SIGBUS). A fresh
# runner gains nothing from incremental caches, and line tables keep
@@ -31,7 +43,7 @@ jobs:
with:
fetch-depth: 2
- name: The base branch, for the parity floor
if: github.event_name == 'pull_request'
if: matrix.shard == 'lint' && github.event_name == 'pull_request'
run: |
git fetch --no-tags --depth=1 origin \
"+refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }}"
@@ -50,6 +62,7 @@ jobs:
# new tip's parent: a push of several commits could otherwise lower
# the floor in an earlier one unseen.
- name: The parity floor holds
if: matrix.shard == 'lint'
env:
BEFORE: ${{ github.event.before }}
run: |
@@ -61,7 +74,7 @@ jobs:
else
scripts/parity-floor.sh HEAD^1
fi
- run: just check
- run: just check-shard ${{ matrix.shard }}
- name: What the build used
if: always()
run: df -h / | tail -1
+55 -6
View File
@@ -11,14 +11,63 @@ netlify := "npm_config_ignore_scripts=true npx --yes netlify-cli@27"
default:
@just --list
# The parts `check` is cut into. A laptop runs them one after another
# (`just check`); CI runs each on a runner of its own, side by side
# (.github/workflows/check.yml), because one runner took 72 minutes for the
# lot on 2026-11-09 (56 of them tests, one binary at a time). There is one
# definition, `check-shard`, so the two cannot drift: what CI checks is
# what `just check` checks. `rest` is every crate not named by another
# part, so a new crate is tested without anyone adding it to a list.
check_shards := "lint gui-unit gui-tests cli rest"
# Everything CI should check: format, clippy and rustdoc (zero warnings), tests
check: sweep-test-tmp
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --quiet
cargo test --workspace
@just server-only
@just sweep-test-tmp
#!/usr/bin/env bash
set -euo pipefail
for shard in {{check_shards}}; do just check-shard "$shard"; done
just sweep-test-tmp
# One part of `check` (one of check_shards)
check-shard shard:
#!/usr/bin/env bash
set -euo pipefail
case "{{shard}}" in
lint)
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --quiet
just server-only
just check-shards-agree
;;
# The viewer's tests are half of the suite's time, in two halves
# of their own: its unit tests, and its integration tests. Between
# them they are every target `cargo test -p ledger-gui` runs: the
# library, the executable, each file under tests/, the doc tests.
gui-unit)
cargo test -p ledger-gui --lib --bins
cargo test -p ledger-gui --doc
;;
gui-tests) cargo test -p ledger-gui --test '*' ;;
cli) cargo test -p ledger-cli ;;
rest) cargo test --workspace --exclude ledger-gui --exclude ledger-cli ;;
*)
echo "check-shard: no part named '{{shard}}' (the parts: {{check_shards}})" >&2
exit 1
;;
esac
# CI's list of parts is this file's: a part CI never runs is a check
# nobody makes, and a part only CI names fails there, not here.
check-shards-agree:
#!/usr/bin/env bash
set -euo pipefail
ci=$(sed -n 's/^ *shard: \[\(.*\)\] *$/\1/p' .github/workflows/check.yml | tr -d ' ' | tr ',' '\n' | sort)
here=$(tr ' ' '\n' <<<"{{check_shards}}" | sort)
if [ -z "$ci" ] || [ "$ci" != "$here" ]; then
echo "check.yml runs [$(echo $ci)], the justfile's check_shards are [$(echo $here)]" >&2
exit 1
fi
echo "check: CI runs every part ($(echo $here))"
# The server-only build (plan D-22, for another machine) builds, passes
# clippy and the one executable's own tests, and links no window libraries.