From 2c96ade1b2ce6148884e5fb4592b7dcb0b89c08b Mon Sep 17 00:00:00 2001 From: Pierre de La Morinerie Date: Tue, 26 Oct 2021 12:01:56 +0000 Subject: [PATCH] ci: split tests automatically --- .github/workflows/ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef3df3965..468dad6dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,15 +47,14 @@ jobs: matrix: pattern: - bin/rake zeitwerk:check - - bin/rspec spec/controllers/*_spec.rb - - bin/rspec spec/controllers/[a-l]**/*_spec.rb - - bin/rspec spec/controllers/[m-z]**/*_spec.rb - - bin/rspec spec/system - - bin/rspec spec/helpers spec/lib spec/middlewares - - bin/rspec spec/mailers spec/jobs spec/policies - - bin/rspec spec/models - - bin/rspec spec/serializers spec/services - - bin/rspec spec/views + - bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=0 -split-total=6) + - bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=1 -split-total=6) + - bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=2 -split-total=6) + - bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=3 -split-total=6) + - bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=4 -split-total=6) + - bin/rspec $(./split_tests -line-count -glob='spec/**/*_spec.rb' -exclude-glob='spec/system/**' -split-index=5 -split-total=6) + - bin/rspec $(./split_tests -line-count -glob='spec/system/**/*_spec.rb' -split-index=0 -split-total=2) + - bin/rspec $(./split_tests -line-count -glob='spec/system/**/*_spec.rb' -split-index=1 -split-total=2) steps: - name: Checkout code @@ -75,6 +74,11 @@ jobs: - name: Install Node modules run: yarn install --frozen-lockfile + - name: Setup split_tests binary + run: | + curl --no-progress-meter -L https://github.com/leonid-shevtsov/split_tests/releases/download/v0.3.0/split_tests.linux.gz | gunzip -c > split_tests + chmod +x split_tests + - name: Setup test database env: RAILS_ENV: test