Skip to content

Commit

Permalink
Add the parallel-ci script
Browse files Browse the repository at this point in the history
  • Loading branch information
jagthedrummer committed Oct 17, 2023
1 parent a9656e7 commit 68815f9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/parallel-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env ruby

sha = ENV['GITHUB_SHA'] || `git rev-parse HEAD`
node_total = ENV["CI_NODE_TOTAL"] || 1
node_index = ENV["CI_NODE_INDEX"] || 0
tests = Dir["test/**/*_test.rb"].
sort.
# Add randomization seed based on SHA of each commit
shuffle(random: Random.new(sha.to_i(16))).
select.
with_index do |el, i|
i % node_total.to_i == node_index.to_i
end

exec "bundle exec rails test #{tests.join(" ")}"

0 comments on commit 68815f9

Please sign in to comment.