From e54152307bccdd4ad38ed1b5995d91ac8814edb8 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 3 Jul 2025 15:01:05 +0900 Subject: [PATCH] ci benchmark: ensure installing old versions --- .github/workflows/benchmark.yml | 7 ++++--- Gemfile | 3 ++- Rakefile | 17 +++++++++++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 6a03cdb7..8602dcc2 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -15,7 +15,7 @@ jobs: - ubuntu-latest - windows-latest runs-on: ${{ matrix.runs-on }} - timeout-minutes: 10 + timeout-minutes: 15 steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 @@ -24,8 +24,9 @@ jobs: - name: Install dependencies run: | bundle install - gem install csv -v 3.0.1 - gem install csv -v 3.0.2 + - name: Install old versions + run: | + rake benchmark:old_versions:install - name: Benchmark run: | rake benchmark diff --git a/Gemfile b/Gemfile index 774eb157..43fd42e8 100644 --- a/Gemfile +++ b/Gemfile @@ -4,9 +4,10 @@ source 'https://rubygems.org' gemspec group :development do + gem "benchmark_driver" gem "bundler" + gem "psych" gem "rake" gem "rdoc" - gem "benchmark_driver" gem "test-unit", ">= 3.4.8" end diff --git a/Rakefile b/Rakefile index 6cdb404a..3d6aa916 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ require "rbconfig" require "rdoc/task" +require "yaml" require "bundler/gem_tasks" @@ -62,6 +63,22 @@ namespace :benchmark do end end end + + namespace :old_versions do + desc "Install used old versions" + task :install do + old_versions = [] + Dir.glob("benchmark/*.yaml") do |yaml| + YAML.load_file(yaml)["contexts"].each do |context| + old_version = (context["gems"] || {})["csv"] + old_versions << old_version if old_version + end + end + old_versions.uniq.sort.each do |old_version| + ruby("-S", "gem", "install", "csv", "-v", old_version) + end + end + end end desc "Run all benchmarks"