Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:

jobs:
rspec:
name: rspec (${{ matrix.ruby-version }}, ${{ matrix.os }}, shard ${{ matrix.shard }})
timeout-minutes: ${{ matrix.os == 'windows' && 30 || 15 }}
runs-on: ${{ format('{0}-latest', matrix.os) }}
name: rspec (${{ matrix.ruby-version }}, ${{ matrix.target.os }}, shard ${{ matrix.target.shard }}/${{ matrix.target.shards }})
timeout-minutes: ${{ matrix.target.os == 'windows' && 30 || 15 }}
runs-on: ${{ format('{0}-latest', matrix.target.os) }}
env:
BUNDLE_WITHOUT: lint
SPEC_WORKERS: ${{ matrix.os == 'windows' && 4 || 8 }}
SPEC_SHARD: ${{ matrix.shard }}
SPEC_WORKERS: ${{ matrix.target.os == 'windows' && 4 || 8 }}
SPEC_SHARD: ${{ matrix.target.shard }}/${{ matrix.target.shards }}

strategy:
fail-fast: false
Expand All @@ -22,10 +22,13 @@ jobs:
- "3.3"
- "3.4"
- "4.0"
os:
- ubuntu
- windows
shard: ["1/3", "2/3", "3/3"]
target:
- { os: ubuntu, shard: 1, shards: 1 }
- { os: windows, shard: 1, shards: 5 }
- { os: windows, shard: 2, shards: 5 }
- { os: windows, shard: 3, shards: 5 }
- { os: windows, shard: 4, shards: 5 }
- { os: windows, shard: 5, shards: 5 }

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -56,7 +59,7 @@ jobs:
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}
flag-name: ruby${{ matrix.ruby-version }}-${{ matrix.os }}-shard${{ strategy.job-index }}
flag-name: ruby${{ matrix.ruby-version }}-${{ matrix.target.os }}-shard${{ matrix.target.shard }}of${{ matrix.target.shards }}
parallel: true

overcommit:
Expand Down
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The best way to see a feature added, however, is to submit a pull request.
# Optionally choose the number of worker processes (default: up to 8 CPUs):
SPEC_WORKERS=4 bundle exec ruby script/parallel_rspec.rb
# Run one runner's share of the suite (default: 1/1, the whole suite):
SPEC_SHARD=1/3 bundle exec ruby script/parallel_rspec.rb
SPEC_SHARD=1/5 bundle exec ruby script/parallel_rspec.rb
```

Workers run in separate processes because specs change the working directory
Expand All @@ -56,6 +56,8 @@ The best way to see a feature added, however, is to submit a pull request.
You can also pass spec paths to run a subset. The `lint` dependency group is
only needed for lint checks; test-only CI jobs install with `BUNDLE_WITHOUT=lint`.

GitHub Actions runs one Linux shard and five Windows shards per Ruby version.

The final `CI` check depends on all test shards and lint, and finalizes coverage reporting.
Repository rulesets can require this single check instead of individual matrix jobs.

Expand Down
2 changes: 1 addition & 1 deletion spec/spec_shard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
described_class.new('1/1').select(examples).should == examples
end

[2, 3].each do |total|
[2, 3, 5].each do |total|
context "with #{total} shards" do
let(:shards) do
(1..total).map { |index| described_class.new("#{index}/#{total}").select(examples) }
Expand Down
Loading