mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
The gate's archive of ~98 test binaries would be 10-18 GB compressed, so every shard restores the dependency cache, builds the tests and runs its partition (scripts/ci-test-shard.sh). `cargo xtask ci tests` runs the test steps on $NEXTEST_PARTITION, `ci build` builds exactly what a shard builds (main's cache warm-up), and `ci doctest` runs in one shard. The `ci archive` part, the archive's xtask binary and the extraction are gone. The Linux GPU shard keeps the gpu group alone on lavapipe; shards 2-4 split the rest. Windows uses six shards: ~55 min of tests on one runner, and its slowest test alone takes ~9.6 min, so a seventh would not shorten the slowest shard.
42 lines
1.5 KiB
Bash
Executable File
42 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# One shard of the gate's tests: the gate's `shard-command` (.github/workflows/ci.yml). Each shard
|
|
# restores the dependency cache, builds the tests (`cargo xtask ci build` builds the same on main's
|
|
# cache warm-up leg) and runs its share with `cargo xtask ci tests`. The gate sets GATE_SHARD (1..N),
|
|
# GATE_SHARDS (N) and NEXTEST_PARTITION (hash:GATE_SHARD/GATE_SHARDS).
|
|
#
|
|
# ci-test-shard.sh each shard runs its hash partition of every test; shard 1 also
|
|
# runs the doctests
|
|
# ci-test-shard.sh --gpu-shard shard 1 runs nextest's `gpu` group alone on lavapipe, checked by
|
|
# scripts/ci-gpu-lavapipe.py; the other shards split the other tests,
|
|
# and shard 2 also runs the doctests
|
|
set -euo pipefail
|
|
|
|
case "${1:-}" in
|
|
"")
|
|
cargo xtask ci tests
|
|
doctests=1
|
|
;;
|
|
--gpu-shard)
|
|
if [ "$GATE_SHARDS" -lt 2 ]; then
|
|
echo "::error::--gpu-shard needs at least two shards, got $GATE_SHARDS"
|
|
exit 1
|
|
fi
|
|
if [ "$GATE_SHARD" = 1 ]; then
|
|
# Build first, so only the test run goes through the lavapipe check.
|
|
cargo xtask ci build
|
|
python3 scripts/ci-gpu-lavapipe.py cargo xtask ci tests --gpu
|
|
else
|
|
NEXTEST_PARTITION="hash:$((GATE_SHARD - 1))/$((GATE_SHARDS - 1))" cargo xtask ci tests --no-gpu
|
|
fi
|
|
doctests=2
|
|
;;
|
|
*)
|
|
echo "usage: $0 [--gpu-shard]" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
if [ "$GATE_SHARD" = "$doctests" ]; then
|
|
cargo xtask ci doctest
|
|
fi
|