CI mirror: split flutter tests into 12 shards
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

At 6 shards of 25 files, shard 1 took 39 s idle and 63-67 s on a busy
machine, past the 60 s build-slot cap. At 12 every shard runs in 11-16 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Krzysztof Rudnicki 2026-11-21 18:52:38 +01:00
parent da147f3325
commit a9f82f52d2
2 changed files with 64 additions and 13 deletions

View File

@ -175,48 +175,96 @@ repos:
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-1
name: CI mirror 5 (flutter test 1/6)
entry: bash scripts/ci_mirror.sh flutter-test --shard 0/6
name: CI mirror 5 (flutter test 1/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 0/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-2
name: CI mirror 6 (flutter test 2/6)
entry: bash scripts/ci_mirror.sh flutter-test --shard 1/6
name: CI mirror 6 (flutter test 2/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 1/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-3
name: CI mirror 7 (flutter test 3/6)
entry: bash scripts/ci_mirror.sh flutter-test --shard 2/6
name: CI mirror 7 (flutter test 3/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 2/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-4
name: CI mirror 8 (flutter test 4/6)
entry: bash scripts/ci_mirror.sh flutter-test --shard 3/6
name: CI mirror 8 (flutter test 4/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 3/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-5
name: CI mirror 9 (flutter test 5/6)
entry: bash scripts/ci_mirror.sh flutter-test --shard 4/6
name: CI mirror 9 (flutter test 5/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 4/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-6
name: CI mirror 10 (flutter test 6/6)
entry: bash scripts/ci_mirror.sh flutter-test --shard 5/6
name: CI mirror 10 (flutter test 6/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 5/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-7
name: CI mirror 11 (flutter test 7/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 6/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-8
name: CI mirror 12 (flutter test 8/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 7/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-9
name: CI mirror 13 (flutter test 9/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 8/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-10
name: CI mirror 14 (flutter test 10/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 9/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-11
name: CI mirror 15 (flutter test 11/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 10/12
language: system
pass_filenames: false
always_run: true
require_serial: true
stages: [manual]
- id: ci-mirror-flutter-test-12
name: CI mirror 16 (flutter test 12/12)
entry: bash scripts/ci_mirror.sh flutter-test --shard 11/12
language: system
pass_filenames: false
always_run: true

View File

@ -147,7 +147,10 @@ run_flutter_gates() {
}
# Bucket I of N of the app's test files (every N-th, sorted), so the N buckets
# partition the suite exactly. Each bucket stays under the 60 s action cap.
# partition the suite exactly. Each bucket stays under the 60 s action cap:
# at 6 buckets of 25 files one took 39 s alone and 63-67 s when the machine
# was busy (2026-11-21), so there are 12 (about 13 files each). Add hooks,
# not files per hook, when the suite grows; a lone file costs about 3 s.
run_flutter_test_shard() {
[[ ${1:-} =~ ^([0-9]+)/([1-9][0-9]*)$ ]] || fail "flutter-test --shard wants I/N, got '${1:-}'"
local index=${BASH_REMATCH[1]} total=${BASH_REMATCH[2]} hooks i=0 file