Skip to content

Commit

Permalink
Use ruby_memcheck in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
kos31de committed Sep 20, 2022
1 parent 5199ff2 commit 5455c36
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/tests.yaml
Expand Up @@ -176,3 +176,16 @@ jobs:
Test outcome: ${{ steps.test.outcome }}
# every step must define a `uses` or `run` key
run: echo NOOP
valgrind:
runs-on: ubuntu-latest
env:
PUMA_RUBY_MEMCHECK: true
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
apt-get: valgrind
- run: bundle exec rake test:valgrind
4 changes: 4 additions & 0 deletions Gemfile
Expand Up @@ -21,6 +21,10 @@ unless ENV['PUMA_NO_RUBOCOP'] || RUBY_PLATFORM.include?('mswin')
gem 'rubocop-performance', require: false
end

if ENV['PUMA_RUBY_MEMCHECK'] && RUBY_PLATFORM.include?('linux')
gem "ruby_memcheck"
end

if RUBY_VERSION == '2.4.1'
gem "stopgap_13632", "~> 1.0", :platforms => ["mri", "mingw", "x64_mingw"]
end
Expand Down
6 changes: 6 additions & 0 deletions Rakefile
Expand Up @@ -104,6 +104,12 @@ namespace :test do
desc "Run all tests"

task :all => :test

if ENV['PUMA_RUBY_MEMCHECK'] && RUBY_PLATFORM.include?('linux')
require 'ruby_memcheck'
RubyMemcheck.config(binary_name: 'puma_http11')
RubyMemcheck::TestTask.new(valgrind: :compile)
end
end

task :default => [:rubocop, "test:all"]
3 changes: 3 additions & 0 deletions test/helper.rb
Expand Up @@ -188,6 +188,8 @@ def self.run(reporter, options = {}) # :nodoc:
def full_name
"#{self.class.name}##{name}"
end

at_exit { GC.start }
end

Minitest.after_run do
Expand All @@ -205,6 +207,7 @@ def full_name
end
end
end
GC.start
end

module AggregatedResults
Expand Down

0 comments on commit 5455c36

Please sign in to comment.