CI mirror: give each flutter shard its own TMPDIR
Some checks are pending
file-length / file length <= 250 lines (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (mypy, mypy, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (pylint, pylint, ) (push) Waiting to run
pre-commit / pre-commit (${{ matrix.group }}) (rest, , mypy,pylint,dependency-freshness) (push) Waiting to run
Tests / test (push) Waiting to run
repo-contract / repo contract (push) Waiting to run

On the shared /tmp a shard stalled at ~2 s of CPU for 15+ minutes and
held a build slot past 60 s. With a private TMPDIR every shard ends
in 11-15 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-21 15:40:55 +01:00
parent 7c13ec3de9
commit e942404213

View File

@ -164,7 +164,14 @@ run_flutter_test_shard() {
done < <(find "$APP_DIR/test" -name '*_test.dart' | LC_ALL=C sort)
((${#files[@]} > 0)) || fail "flutter test shard $index/$total has no test files"
log "flutter test shard $index/$total (${#files[@]} files)"
(cd "$APP_DIR" && flutter_clean_env test "${files[@]}") || fail "flutter test shard $index/$total"
# A private TMPDIR per shard: on the shared /tmp a shard stalled at ~2 s of
# CPU for 15+ minutes (2026-11-21, held a build slot past 60 s) while the
# same shard with its own TMPDIR finished in well under a minute.
local tmp status=0
tmp="$(mktemp -d "${XDG_CACHE_HOME:-$HOME/.cache}/diet-guard-flutter-test.XXXXXX")"
(cd "$APP_DIR" && TMPDIR="$tmp" flutter_clean_env test "${files[@]}") || status=$?
rm -rf -- "$tmp"
((status == 0)) || fail "flutter test shard $index/$total"
}
# No phase argument (or pytest options) runs everything, exactly as CI does.