Skip to content

Commit 8aec52d

Browse files
committed
Setup ruby_memcheck
Hoping it might find the leak reported in ruby#460
1 parent 942cd3f commit 8aec52d

File tree

4 files changed

+71
-30
lines changed

4 files changed

+71
-30
lines changed

.github/workflows/ci.yml

+4-30
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,20 @@ on:
66
- workflow_dispatch
77

88
jobs:
9-
ruby-versions:
10-
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
11-
with:
12-
engine: cruby-jruby
13-
min_version: 2.7
14-
159
host:
1610
needs: ruby-versions
17-
name: ${{ matrix.os }} ${{ matrix.ruby }}
18-
runs-on: ${{ matrix.os }}
11+
name: Ruby memcheck
12+
runs-on: ubuntu-22.04
1913
strategy:
2014
fail-fast: false
21-
matrix:
22-
os:
23-
- ubuntu-22.04
24-
- macos-13
25-
- macos-14
26-
- windows-latest
27-
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
28-
include:
29-
- { os: windows-latest , ruby: mswin } # ruby/ruby windows CI
30-
- { os: ubuntu-latest , ruby: jruby-9.4 } # Ruby 3.1
31-
- { os: macos-latest , ruby: truffleruby-head }
32-
- { os: ubuntu-latest , ruby: truffleruby-head }
33-
exclude:
34-
- { os: windows-latest, ruby: jruby }
35-
- { os: windows-latest, ruby: jruby-head }
3615

3716
steps:
3817
- uses: actions/checkout@v3
3918

4019
- name: Set up Ruby
4120
uses: ruby/setup-ruby-pkgs@v1
4221
with:
43-
ruby-version: ${{ matrix.ruby }}
22+
ruby-version: "3.3"
4423
apt-get: ragel
4524
brew: ragel
4625

@@ -50,9 +29,4 @@ jobs:
5029
5130
- run: rake compile
5231

53-
- run: rake test
54-
55-
- run: rake build
56-
57-
- run: gem install pkg/*.gem
58-
if: ${{ matrix.ruby != '3.2' }}
32+
- run: rake valgrind

.github/workflows/memcheck.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
- workflow_dispatch
7+
8+
jobs:
9+
ruby-versions:
10+
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
11+
with:
12+
engine: cruby-jruby
13+
min_version: 2.7
14+
15+
host:
16+
needs: ruby-versions
17+
name: ${{ matrix.os }} ${{ matrix.ruby }}
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
os:
23+
- ubuntu-22.04
24+
- macos-13
25+
- macos-14
26+
- windows-latest
27+
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
28+
include:
29+
- { os: windows-latest , ruby: mswin } # ruby/ruby windows CI
30+
- { os: ubuntu-latest , ruby: jruby-9.4 } # Ruby 3.1
31+
- { os: macos-latest , ruby: truffleruby-head }
32+
- { os: ubuntu-latest , ruby: truffleruby-head }
33+
exclude:
34+
- { os: windows-latest, ruby: jruby }
35+
- { os: windows-latest, ruby: jruby-head }
36+
37+
steps:
38+
- uses: actions/checkout@v3
39+
40+
- name: Set up Ruby
41+
uses: ruby/setup-ruby-pkgs@v1
42+
with:
43+
ruby-version: ${{ matrix.ruby }}
44+
apt-get: ragel
45+
brew: ragel
46+
47+
- run: |
48+
bundle config --without benchmark
49+
bundle install
50+
51+
- run: rake compile
52+
53+
- run: rake test
54+
55+
- run: rake build
56+
57+
- run: gem install pkg/*.gem
58+
if: ${{ matrix.ruby != '3.2' }}

Gemfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ else
77
end
88

99
group :development do
10+
gem "ruby_memcheck"
1011
gem "ostruct"
1112
gem "rake"
1213
gem "rake-compiler"

Rakefile

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require "ruby_memcheck"
2+
13
begin
24
require 'rubygems/package_task'
35
rescue LoadError
@@ -250,6 +252,12 @@ else
250252
t.options = '-v'
251253
end
252254

255+
RubyMemcheck::TestTask.new(valgrind: [ :set_env_ext, :check_env, :compile, :do_test_ext ]) do |t|
256+
t.test_files = FileList['test/json/*_test.rb']
257+
t.verbose = true
258+
t.options = '-v'
259+
end
260+
253261
desc "Update the tags file"
254262
task :tags do
255263
system 'ctags', *Dir['**/*.{rb,c,h,java}']

0 commit comments

Comments
 (0)