-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is closely based on alphagov/whitehall#8364. I've put `minitest-ci` in the `scripts` directory rather than the `bin` directory, because I think the latter is usually reserved for built-in scripts. I've made `minitest-ci` executable in the git repo rather than having a separate step in the workflow job. I've run rubocop auto-correct against `minitest-ci` to fix some violations. I haven't bothered to split the Ruby tests out into a separate workflow file for now.
- Loading branch information
1 parent
2ddf478
commit b98ab99
Showing
2 changed files
with
31 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# This script is used during the GitHub Actions workflow | ||
# defined in .github/workflows/ci.yml. | ||
# It splits the MiniTest suite into randomly-allocated groups | ||
# which are executed across multiple GitHub Actions 'matrix' nodes. | ||
|
||
tests = Dir["test/**/*_test.rb"] | ||
.sort | ||
.shuffle(random: Random.new(ENV["GITHUB_SHA"].to_i(16))) | ||
.select | ||
.with_index do |_el, i| | ||
i % ENV["CI_NODE_TOTAL"].to_i == ENV["CI_NODE_INDEX"].to_i | ||
end | ||
|
||
exec "bundle exec rails test #{tests.join(' ')}" |