-
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.
Merge pull request #2459 from alphagov/parallelize-ruby-tests-in-ci-b…
…uild Parallelize Ruby tests in CI build
- Loading branch information
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(' ')}" |