Repository navigation
Faster CI: shard tests by file, cache analysis, skip needless web builds - #37
Merged
Merged
Conversation
`flutter test --total-shards` splits the tests, not the files: every shard still compiled all ~105 test files, which is most of the suite's time, and then ran a third of them, so each shard took ~3 min of the old job's 4. Each shard now takes every third file and compiles only those. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Analyze keeps `dart analyze`'s own cache — summaries of the SDK, the dependencies and every library it has seen — between runs. Locally that took analysis from 48 s with an empty cache to 27 s warm, for 76 MB. - A pull request that touches only what the web build does not compile (tests, the native runners, the git hooks) skips it. Checked inside the job, so the web build — now CI's longest — does not wait for `detect` first. Workflow changes still build: they can break the job. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
A relative --cache is resolved against the analyzer's own install for the plugin builds it keeps there, so riverpod_lint failed to load and Analyze exited 4 — caught by the plugin-load guard. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Follow-up to #36, which took a pull request from ~12½ min to 4m35s. Three more:
5f672a5).flutter test --total-shardssplits the tests, not the files: every shard still compiled all ~105 test files — most of the suite's time — and ran a third of them, ~3 min each. Each shard now takes every third file (git ls-files, so a new file joins a shard on its own) and compiles only those. Measured on this PR: shards ~105–120 s of tests, and the whole run 2m52s.a3917c9,9d1a0c4).dart analyze --cache=<absolute path>, kept between runs withactions/cache(~61 MB). Measured on this PR: Analyze 84 s cold → 32 s warm (+3 s to restore). The path has to be absolute: a relative one is resolved against the analyzer's own install for the plugin builds it keeps there, riverpod_lint then fails to load, and the plugin-load guard fails the step — which is what the first run here did.a3917c9). A pull request touching only tests, native runners or the git hooks skips it. Checked inside the job rather than bydetect, so the web build — now CI's longest job — doesn't wait for another job first. Workflow changes still build, since they can break the job.How it was verified
lib/and workflow changesworkflow_dispatchrun on the branch can't see the PR's)Pushed without the local pre-push hook: workflow-only changes, which CI checks itself.
Not done
Compiling each shard's tests as one generated file was tried and dropped: combined into one isolate, the suite hung in
port_hover_label_teston state left by an earlier file, and some tests depend on per-isolate state (re_editor caches the platform once per isolate). Not safe without auditing every file.🤖 Generated with Claude Code