Skip to content

Commit 0bcb71f

Browse files
authored
ci benchmark: ensure installing old versions (#349)
Benchmark CI is failing because csv 3.3.0 isn't installed: https://github.com/ruby/csv/actions/runs/15481241182/job/43587350229#step:5:10 ```text /opt/hostedtoolcache/Ruby/3.4.4/x64/lib/ruby/3.4.0/rubygems/dependency.rb:303:in 'Gem::Dependency#to_specs': Could not find 'csv' (= 3.3.0) - did find: [csv-3.3.2,csv-3.0.2,csv-3.0.1] (Gem::MissingSpecVersionError) ```
1 parent 650b9c2 commit 0bcb71f

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

.github/workflows/benchmark.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- ubuntu-latest
1616
- windows-latest
1717
runs-on: ${{ matrix.runs-on }}
18-
timeout-minutes: 10
18+
timeout-minutes: 15
1919
steps:
2020
- uses: actions/checkout@v4
2121
- uses: ruby/setup-ruby@v1
@@ -24,8 +24,9 @@ jobs:
2424
- name: Install dependencies
2525
run: |
2626
bundle install
27-
gem install csv -v 3.0.1
28-
gem install csv -v 3.0.2
27+
- name: Install old versions
28+
run: |
29+
rake benchmark:old_versions:install
2930
- name: Benchmark
3031
run: |
3132
rake benchmark

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ source 'https://rubygems.org'
44
gemspec
55

66
group :development do
7+
gem "benchmark_driver"
78
gem "bundler"
9+
gem "psych"
810
gem "rake"
911
gem "rdoc"
10-
gem "benchmark_driver"
1112
gem "test-unit", ">= 3.4.8"
1213
end

Rakefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
require "rbconfig"
22
require "rdoc/task"
3+
require "yaml"
34

45
require "bundler/gem_tasks"
56

@@ -62,6 +63,22 @@ namespace :benchmark do
6263
end
6364
end
6465
end
66+
67+
namespace :old_versions do
68+
desc "Install used old versions"
69+
task :install do
70+
old_versions = []
71+
Dir.glob("benchmark/*.yaml") do |yaml|
72+
YAML.load_file(yaml)["contexts"].each do |context|
73+
old_version = (context["gems"] || {})["csv"]
74+
old_versions << old_version if old_version
75+
end
76+
end
77+
old_versions.uniq.sort.each do |old_version|
78+
ruby("-S", "gem", "install", "csv", "-v", old_version)
79+
end
80+
end
81+
end
6582
end
6683

6784
desc "Run all benchmarks"

0 commit comments

Comments
 (0)