Skip to content

Commit 9b77394

Browse files
authored
Merge pull request #9575 from ruby/bundler-intel-tag-groups
Split `macos-15-intel` bundler tests into four shards
2 parents 386fb2c + 2843b64 commit 9b77394

3 files changed

Lines changed: 38 additions & 30 deletions

File tree

.github/workflows/bundler.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,26 @@ jobs:
4040
- { os: { name: macOS, value: macos-26 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 90 }
4141
- { os: { name: macOS, value: macos-26 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 90 }
4242

43-
# Regression coverage for the Intel architecture with the latest Ruby only
44-
- { os: { name: macOS-intel, value: macos-15-intel }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 90 }
43+
# Regression coverage for the Intel architecture with the latest Ruby only.
44+
# Split across runners using the test shards to keep each run reasonable.
45+
- { os: { name: macOS-intel, value: macos-15-intel }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 90, shard: a }
46+
- { os: { name: macOS-intel, value: macos-15-intel }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 90, shard: b }
47+
- { os: { name: macOS-intel, value: macos-15-intel }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 90, shard: c }
48+
- { os: { name: macOS-intel, value: macos-15-intel }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 90, shard: d }
4549

4650
# Ruby 3.2 is about 20 minutes slower than 3.3/3.4, so it will be excluded from testing.
47-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, group: a }
48-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, group: b }
49-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, group: c }
50-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, group: d }
51-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, group: a }
52-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, group: b }
53-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, group: c }
54-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, group: d }
55-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, group: a }
56-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, group: b }
57-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, group: c }
58-
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, group: d }
51+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, shard: a }
52+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, shard: b }
53+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, shard: c }
54+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.3, value: 3.3.11 }, timeout: 150, shard: d }
55+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, shard: a }
56+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, shard: b }
57+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, shard: c }
58+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-3.4, value: 3.4.9 }, timeout: 150, shard: d }
59+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, shard: a }
60+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, shard: b }
61+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, shard: c }
62+
- { os: { name: Windows, value: windows-2025 }, ruby: { name: ruby-4.0, value: 4.0.5 }, timeout: 150, shard: d }
5963

6064
- { os: { name: Ubuntu, value: ubuntu-24.04 }, ruby: { name: jruby, value: jruby-10.1.0.0 } }
6165
- { os: { name: macOS, value: macos-26 }, ruby: { name: jruby, value: jruby-10.1.0.0 } }
@@ -129,11 +133,15 @@ jobs:
129133
- name: Run Test (CRuby)
130134
run: |
131135
bin/parallel_rspec
132-
if: matrix.ruby.name != 'jruby' && matrix.ruby.name != 'truffleruby' && matrix.os.name != 'Windows'
133-
- name: Run Test (CRuby on Windows - Group ${{ matrix.group }})
136+
if: matrix.ruby.name != 'jruby' && matrix.ruby.name != 'truffleruby' && matrix.os.name != 'Windows' && matrix.os.name != 'macOS-intel'
137+
- name: Run Test (CRuby on Windows - Shard ${{ matrix.shard }})
134138
run: |
135-
bin/parallel_rspec --tag windows_${{ matrix.group }}
139+
bin/parallel_rspec --tag shard_${{ matrix.shard }}
136140
if: matrix.ruby.name != 'jruby' && matrix.ruby.name != 'truffleruby' && matrix.os.name == 'Windows'
141+
- name: Run Test (CRuby on macOS Intel - Shard ${{ matrix.shard }})
142+
run: |
143+
bin/parallel_rspec --tag shard_${{ matrix.shard }}
144+
if: matrix.ruby.name != 'jruby' && matrix.ruby.name != 'truffleruby' && matrix.os.name == 'macOS-intel'
137145
- name: Run Test (JRuby)
138146
run: |
139147
bin/parallel_rspec --tag jruby_only --tag jruby

spec/spec_helper.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
require_relative "support/matchers"
3939
require_relative "support/permissions"
4040
require_relative "support/platforms"
41-
require_relative "support/windows_tag_group"
41+
require_relative "support/shards"
4242

4343
begin
4444
raise LoadError if File.exist?(File.expand_path("../../lib/bundler/bundler.gemspec", __dir__))
@@ -88,7 +88,7 @@ def self.ruby=(ruby)
8888
config.include Spec::Path
8989
config.include Spec::Platforms
9090
config.include Spec::Permissions
91-
config.include Spec::WindowsTagGroup
91+
config.include Spec::Shards
9292

9393
# Enable flags like --only-failures and --next-failure
9494
config.example_status_persistence_file_path = ".rspec_status"
@@ -175,7 +175,7 @@ def self.ruby=(ruby)
175175
reset!
176176
end
177177

178-
Spec::WindowsTagGroup::EXAMPLE_MAPPINGS.each do |tag, file_paths|
178+
Spec::Shards::EXAMPLE_MAPPINGS.each do |tag, file_paths|
179179
file_pattern = Regexp.union(file_paths.map {|path| Regexp.new(Regexp.escape(path) + "$") })
180180

181181
config.define_derived_metadata(file_path: file_pattern) do |metadata|
@@ -185,8 +185,8 @@ def self.ruby=(ruby)
185185

186186
config.before(:context) do |example|
187187
metadata = example.class.metadata
188-
if metadata[:type] != :aruba && !metadata[:realworld] && metadata.keys.none? {|k| Spec::WindowsTagGroup::EXAMPLE_MAPPINGS.keys.include?(k) }
189-
warn "#{metadata[:file_path]} is not assigned to any Windows runner group. see spec/support/windows_tag_group.rb for details."
188+
if metadata[:type] != :aruba && !metadata[:realworld] && metadata.keys.none? {|k| Spec::Shards::EXAMPLE_MAPPINGS.keys.include?(k) }
189+
warn "#{metadata[:file_path]} is not assigned to any shard. see spec/support/shards.rb for details."
190190
end
191191
end unless Spec::Path.ruby_core?
192192
end
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# frozen_string_literal: true
22

3-
# This group classifies test files into 4 groups by running `bin/rspec --profile 10000`
3+
# This classifies test files into 4 shards by running `bin/rspec --profile 10000`
44
# to ensure balanced execution times. When adding new test files, it is recommended to
5-
# re-aggregate and adjust the groups to keep them balanced.
6-
# For now, please add new files to group 'windows_d'.
5+
# re-aggregate and adjust the shards to keep them balanced.
6+
# For now, please add new files to shard 'shard_d'.
77

88
module Spec
9-
module WindowsTagGroup
9+
module Shards
1010
EXAMPLE_MAPPINGS = {
11-
windows_a: [
11+
shard_a: [
1212
"spec/runtime/setup_spec.rb",
1313
"spec/commands/install_spec.rb",
1414
"spec/commands/add_spec.rb",
@@ -53,7 +53,7 @@ module WindowsTagGroup
5353
"spec/bundler/plugin/source_list_spec.rb",
5454
"spec/bundler/source/path_spec.rb",
5555
],
56-
windows_b: [
56+
shard_b: [
5757
"spec/install/gemfile/git_spec.rb",
5858
"spec/install/gems/standalone_spec.rb",
5959
"spec/commands/lock_spec.rb",
@@ -97,7 +97,7 @@ module WindowsTagGroup
9797
"spec/bundler/index_spec.rb",
9898
"spec/other/cli_man_pages_spec.rb",
9999
],
100-
windows_c: [
100+
shard_c: [
101101
"spec/commands/newgem_spec.rb",
102102
"spec/commands/exec_spec.rb",
103103
"spec/commands/clean_spec.rb",
@@ -142,7 +142,7 @@ module WindowsTagGroup
142142
"spec/bundler/cli_common_spec.rb",
143143
"spec/bundler/ci_detector_spec.rb",
144144
],
145-
windows_d: [
145+
shard_d: [
146146
"spec/commands/outdated_spec.rb",
147147
"spec/commands/update_spec.rb",
148148
"spec/lock/lockfile_spec.rb",

0 commit comments

Comments
 (0)