From a9f82f52d2ac86e5f26c889e8db8330b7c5a414a Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 21 Nov 2026 18:52:38 +0100 Subject: [PATCH] CI mirror: split flutter tests into 12 shards 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 --- .pre-commit-config.yaml | 72 ++++++++++++++++++++++++++++++++++------- scripts/ci_mirror.sh | 5 ++- 2 files changed, 64 insertions(+), 13 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 514af87..3761bd0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/scripts/ci_mirror.sh b/scripts/ci_mirror.sh index f298c31..e9bad2b 100755 --- a/scripts/ci_mirror.sh +++ b/scripts/ci_mirror.sh @@ -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