Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --shard flag for splitting tests across parallel CI jobs #14

Merged
merged 2 commits into from
Feb 24, 2024

Conversation

mattbrictson
Copy link
Owner

With this commit, mighty_test can now distribute test files evenly across parallel CI jobs, using the --shard option. The shard nomenclature has been borrowed from similar features in Jest and Playwright.

# Run the 1st group of tests out of 4 total groups
bin/mt --shard 1/4

Test files are shuffled before dividing into shards. To ensure the shuffle is consistent across CI nodes, the SHA of the git commit being tested is used as the random seed. If the SHA cannot be determined, a hard-coded seed is used.

With this commit, mighty_test can now distribute test files evenly
across parallel CI jobs, using the `--shard` option. The _shard_
nomenclature has been borrowed from similar features in
[Jest](https://jestjs.io/docs/cli#--shard) and
[Playwright](https://playwright.dev/docs/test-sharding).

```sh
# Run the 1st group of tests out of 4 total groups
bin/mt --shard 1/4
```

Test files are shuffled before dividing into shards. To ensure the
shuffle is consistent across CI nodes, the SHA of the git commit being
tested is used as the random seed. If the SHA cannot be determined, a
hard-coded seed is used.
@mattbrictson mattbrictson added the ✨ Feature Adds a new feature label Feb 24, 2024
@mattbrictson mattbrictson merged commit 0d7f124 into main Feb 24, 2024
6 checks passed
@mattbrictson mattbrictson deleted the shard branch February 24, 2024 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ Feature Adds a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant