Skip to content

Commit

Permalink
Run ruby_memcheck in CI
Browse files Browse the repository at this point in the history
So we can catch any new memory leaks, run ruby_memcheck as part of the
build.

Note we skip installing ruby_memcheck for all jobs by default and opt
into it explicitly.
  • Loading branch information
mudge committed May 10, 2024
1 parent f3e094c commit 2676873
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,3 +452,20 @@ jobs:
path: pkg
- run: apk add bash libstdc++ gcompat
- run: ./scripts/test-gem-install

ruby-memcheck:
runs-on: "ubuntu-latest"
env:
BUNDLE_WITH: memcheck
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ports/archives
key: archives-ubuntu-${{ hashFiles('ext/re2/extconf.rb') }}
- uses: ruby/setup-ruby-pkgs@v1
with:
ruby-version: "3.3"
apt-get: valgrind
bundler-cache: true
- run: bundle exec rake spec:valgrind
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ source "https://rubygems.org"
gemspec

gem "rake", "> 12.3.2"

group :memcheck, optional: true do
gem "ruby_memcheck"
end
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require 'rake/extensiontask'
require 'rake_compiler_dock'
require 'rspec/core/rake_task'
require 'ruby_memcheck'
require 'ruby_memcheck/rspec/rake_task'

require_relative 'ext/re2/recipes'

Expand Down Expand Up @@ -46,6 +48,10 @@ end

RSpec::Core::RakeTask.new(:spec)

namespace :spec do
RubyMemcheck::RSpec::RakeTask.new(valgrind: :compile)
end

namespace :gem do
cross_platforms.each do |platform|

Expand Down

0 comments on commit 2676873

Please sign in to comment.