Skip to content

Commit f53bc29

Browse files
authored
Merge pull request #458 from Shopify/bump-ruby-lsp-dependencies
Fix CI and ruby-lsp benchmark
2 parents 6f08643 + 64ce9ad commit f53bc29

File tree

6 files changed

+91
-10
lines changed

6 files changed

+91
-10
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ jobs:
3333
uses: ruby/setup-ruby@v1
3434
with:
3535
ruby-version: ${{ matrix.ruby }}
36+
bundler-cache: true
3637

3738
- name: Run tests
38-
run: rake test
39+
run: bundle exec rake test
3940

4041
benchmark-default:
4142
runs-on: ubuntu-latest

Gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
gem "csv"
6+
gem "gruff"
7+
gem "minitest", "~> 5.0"
8+
gem "minitest-mock"
9+
gem "rake"
10+
gem "rmagick"

Gemfile.lock

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
bigdecimal (4.0.1)
5+
csv (3.3.5)
6+
gruff (0.29.0)
7+
bigdecimal (>= 3.0)
8+
histogram
9+
rmagick (>= 5.5)
10+
histogram (0.2.4.1)
11+
minitest (5.27.0)
12+
minitest-mock (5.27.0)
13+
observer (0.1.2)
14+
pkg-config (1.6.5)
15+
rake (13.3.1)
16+
rmagick (6.1.5)
17+
observer (~> 0.1)
18+
pkg-config (~> 1.4)
19+
20+
PLATFORMS
21+
arm64-darwin-24
22+
ruby
23+
x86_64-linux
24+
25+
DEPENDENCIES
26+
csv
27+
gruff
28+
minitest (~> 5.0)
29+
minitest-mock
30+
rake
31+
rmagick
32+
33+
CHECKSUMS
34+
bigdecimal (4.0.1) sha256=8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7
35+
csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f
36+
gruff (0.29.0) sha256=ab808cbf507abda7ffacd4ba5805a43c47ad0ec6aa2a7b125cf8a165110047a0
37+
histogram (0.2.4.1) sha256=9a6e379172b88ea842ab71700a535dd037185a4e17abcce742c7444679ae2abc
38+
minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
39+
minitest-mock (5.27.0) sha256=7040ed7185417a966920987eaa6eaf1be4ea1fc5b25bb03ff4703f98564a55b0
40+
observer (0.1.2) sha256=d8a3107131ba661138d748e7be3dbafc0d82e732fffba9fccb3d7829880950ac
41+
pkg-config (1.6.5) sha256=33f9f81c5322983d22b439b8b672f27777b406fea23bfec74ff14bbeb42ec733
42+
rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
43+
rmagick (6.1.5) sha256=91c1734cc0effc3b1be18e6705ea0353d73cb492547002f542763fa08445acd1
44+
45+
BUNDLED WITH
46+
4.0.3

benchmarks/ruby-lsp/Gemfile.lock

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@ GEM
33
specs:
44
language_server-protocol (3.17.0.5)
55
logger (1.7.0)
6-
prism (1.4.0)
7-
rbs (3.9.4)
6+
prism (1.7.0)
7+
rbs (4.0.0.dev.5)
88
logger
9+
prism (>= 1.3.0)
10+
tsort
911
ruby-lsp (0.17.17)
1012
language_server-protocol (~> 3.17.0)
1113
prism (~> 1.0)
1214
rbs (>= 3, < 4)
1315
sorbet-runtime (>= 0.5.10782)
14-
sorbet-runtime (0.5.12366)
16+
sorbet-runtime (0.6.12878)
17+
tsort (0.2.0)
1518

1619
PLATFORMS
1720
ruby
@@ -23,10 +26,11 @@ DEPENDENCIES
2326
CHECKSUMS
2427
language_server-protocol (3.17.0.5) sha256=fd1e39a51a28bf3eec959379985a72e296e9f9acfce46f6a79d31ca8760803cc
2528
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
26-
prism (1.4.0) sha256=dc0e3e00e93160213dc2a65519d9002a4a1e7b962db57d444cf1a71565bb703e
27-
rbs (3.9.4) sha256=8e42c8f133fc2d94b65f62f34479546de1247b79892b57584f625b61e518a5d7
29+
prism (1.7.0) sha256=10062f734bf7985c8424c44fac382ac04a58124ea3d220ec3ba9fe4f2da65103
30+
rbs (4.0.0.dev.5) sha256=273938e5a9c7f06b041be583588f2aa1976149bda2ce213e33e129c51534e174
2831
ruby-lsp (0.17.17) sha256=6147b40dd3fe344369c1ba42da9b4ac21334ccadf0d321a0cba782624a9b798b
29-
sorbet-runtime (0.5.12366) sha256=67e432b5b3581ed0c991de2178dddcf9e397b6d9b31995849795b0a802837afe
32+
sorbet-runtime (0.6.12878) sha256=e1efa4b73f6d111025d9978a63b6c0f31ab7603027ce272591449d10888c83c9
33+
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
3034

3135
BUNDLED WITH
3236
4.0.0

lib/benchmark_suite.rb

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,25 @@ def run(ruby:, ruby_description:)
4343
env = benchmark_env(ruby)
4444
caller_json_path = ENV["RESULT_JSON_PATH"]
4545

46+
# Capture quiet setting before entering unbundled env (which clears ENV)
47+
quiet = ENV['BENCHMARK_QUIET'] == '1'
48+
4649
benchmark_entries.each_with_index do |entry, idx|
4750
puts("Running benchmark \"#{entry.name}\" (#{idx+1}/#{benchmark_entries.length})")
4851

4952
result_json_path = caller_json_path || File.join(out_path, "temp#{Process.pid}.json")
5053
cmd_prefix = base_cmd(ruby_description, entry.name)
51-
result = run_single_benchmark(entry.script_path, result_json_path, ruby, cmd_prefix, env, entry.name)
54+
55+
# Clear project-level Bundler environment so benchmarks run in a clean context.
56+
# Benchmarks that need Bundler (e.g., railsbench) set up their own via use_gemfile.
57+
# This is important when running tests under `bundle exec rake test`.
58+
result = if defined?(Bundler)
59+
Bundler.with_unbundled_env do
60+
run_single_benchmark(entry.script_path, result_json_path, ruby, cmd_prefix, env, entry.name, quiet: quiet)
61+
end
62+
else
63+
run_single_benchmark(entry.script_path, result_json_path, ruby, cmd_prefix, env, entry.name, quiet: quiet)
64+
end
5265

5366
if result[:success]
5467
bench_data[entry.name] = process_benchmark_result(result_json_path, result[:command], delete_file: !caller_json_path)
@@ -120,7 +133,7 @@ def filter_entries(entries, categories:, name_filters:, excludes:, directory_map
120133
entries.select { |entry| filter.match?(entry.name) }
121134
end
122135

123-
def run_single_benchmark(script_path, result_json_path, ruby, cmd_prefix, env, benchmark_name)
136+
def run_single_benchmark(script_path, result_json_path, ruby, cmd_prefix, env, benchmark_name, quiet: false)
124137
# Fix for jruby/jruby#7394 in JRuby 9.4.2.0
125138
script_path = File.expand_path(script_path)
126139

@@ -141,7 +154,7 @@ def run_single_benchmark(script_path, result_json_path, ruby, cmd_prefix, env, b
141154
].compact
142155

143156
# Do the benchmarking
144-
result = BenchmarkRunner.check_call(cmd.shelljoin, env: env, raise_error: false)
157+
result = BenchmarkRunner.check_call(cmd.shelljoin, env: env, raise_error: false, quiet: quiet)
145158
result[:command] = cmd.shelljoin
146159
result
147160
ensure
@@ -177,6 +190,12 @@ def benchmark_env(ruby)
177190
end
178191
end
179192

193+
# Pass benchmark configuration env vars to subprocess.
194+
# These may be set after bundler loads, so they'd be lost with with_unbundled_env.
195+
["WARMUP_ITRS", "MIN_BENCH_ITRS", "MIN_BENCH_TIME", "YJIT_BENCH_STATS", "ZJIT_BENCH_STATS"].each do |var|
196+
env[var] = ENV[var] if ENV.key?(var)
197+
end
198+
180199
env
181200
end
182201

test/test_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
require 'minitest/autorun'
2+
require 'minitest/mock'

0 commit comments

Comments
 (0)