diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 60dbab9d..645e0d54 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 diff --git a/justfile b/justfile index 68a56423..89898966 100644 --- a/justfile +++ b/justfile @@ -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.