Skip to content

Commit

Permalink
Setup ruby_memcheck
Browse files Browse the repository at this point in the history
Hoping it might find the leak reported in ruby#460
  • Loading branch information
byroot committed Oct 30, 2024
1 parent 942cd3f commit 8aec52d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 30 deletions.
34 changes: 4 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,20 @@ on:
- workflow_dispatch

jobs:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby-jruby
min_version: 2.7

host:
needs: ruby-versions
name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}
name: Ruby memcheck
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-13
- macos-14
- windows-latest
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
include:
- { os: windows-latest , ruby: mswin } # ruby/ruby windows CI
- { os: ubuntu-latest , ruby: jruby-9.4 } # Ruby 3.1
- { os: macos-latest , ruby: truffleruby-head }
- { os: ubuntu-latest , ruby: truffleruby-head }
exclude:
- { os: windows-latest, ruby: jruby }
- { os: windows-latest, ruby: jruby-head }

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: "3.3"
apt-get: ragel
brew: ragel

Expand All @@ -50,9 +29,4 @@ jobs:
- run: rake compile

- run: rake test

- run: rake build

- run: gem install pkg/*.gem
if: ${{ matrix.ruby != '3.2' }}
- run: rake valgrind
58 changes: 58 additions & 0 deletions .github/workflows/memcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
- push
- pull_request
- workflow_dispatch

jobs:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby-jruby
min_version: 2.7

host:
needs: ruby-versions
name: ${{ matrix.os }} ${{ matrix.ruby }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-22.04
- macos-13
- macos-14
- windows-latest
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
include:
- { os: windows-latest , ruby: mswin } # ruby/ruby windows CI
- { os: ubuntu-latest , ruby: jruby-9.4 } # Ruby 3.1
- { os: macos-latest , ruby: truffleruby-head }
- { os: ubuntu-latest , ruby: truffleruby-head }
exclude:
- { os: windows-latest, ruby: jruby }
- { os: windows-latest, ruby: jruby-head }

steps:
- uses: actions/checkout@v3

- name: Set up Ruby
uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: ${{ matrix.ruby }}
apt-get: ragel
brew: ragel

- run: |
bundle config --without benchmark
bundle install
- run: rake compile

- run: rake test

- run: rake build

- run: gem install pkg/*.gem
if: ${{ matrix.ruby != '3.2' }}
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ else
end

group :development do
gem "ruby_memcheck"
gem "ostruct"
gem "rake"
gem "rake-compiler"
Expand Down
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require "ruby_memcheck"

begin
require 'rubygems/package_task'
rescue LoadError
Expand Down Expand Up @@ -250,6 +252,12 @@ else
t.options = '-v'
end

RubyMemcheck::TestTask.new(valgrind: [ :set_env_ext, :check_env, :compile, :do_test_ext ]) do |t|
t.test_files = FileList['test/json/*_test.rb']
t.verbose = true
t.options = '-v'
end

desc "Update the tags file"
task :tags do
system 'ctags', *Dir['**/*.{rb,c,h,java}']
Expand Down

0 comments on commit 8aec52d

Please sign in to comment.