chore(app): shard the frontend unit tests because they take too long #20341
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.
Overview
The app frontend unit tests take > 30 minutes to run nowadays, which slows me down greatly when I'm waiting for the CI tests to finish. This change takes advantage of Vitest's sharding functionality (
--shard) to split the tests up and run them in parallel on multiple GitHub runners.The idea is that each shard runs a subset of the frontend unit tests. Each runner produces a Vitest result file (via
--reporter=blob) and a coverage result file. We upload those files to temporary GitHub workflow artifact storage.Then another runner waits for all the shards to finish, downloads the shard results, and merges them into a single Vitest result (with
vitest --merge-reports), and merges the coverage results into a single file to send to Codecov.This PR also fixes a small bug:
Previously, we did not specify our Codecov token in the
Upload coverage reportstep, so it was failing with the errorPlease upload with the Codecov repository upload token to resolve issue, but no one had noticed the problem before.Test Plan and Hands on Testing
Tested manually by carefully watching the CI runs on this PR.
Risk assessment
Low.