From a659606f9bf0f1d1ddda9a6a71d0e7ca6c0e38e9 Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 10 Nov 2024 17:29:01 -0800 Subject: [PATCH] Added memcheck to CI --- .github/workflows/build.yml | 21 +++++++++++++-------- Gemfile | 1 + Rakefile | 8 +++++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86883b1..6939843 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,14 +9,14 @@ jobs: include: - ruby: 3.3 os: ubuntu-24.04 - - ruby: 3.2 - os: ubuntu-22.04 - - ruby: 3.1 - os: ubuntu-20.04 - - ruby: 3.2 - os: macos-14 - - ruby: 3.1 - os: macos-13 + # - ruby: 3.2 + # os: ubuntu-22.04 + # - ruby: 3.1 + # os: ubuntu-20.04 + # - ruby: 3.2 + # os: macos-14 + # - ruby: 3.1 + # os: macos-13 steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 @@ -25,3 +25,8 @@ jobs: bundler-cache: true - run: bundle exec rake compile - run: bundle exec rake test + + - if: ${{ startsWith(matrix.os, 'ubuntu') }} + run: | + sudo apt-get update && sudo apt-get install valgrind + bundle exec rake test:valgrind diff --git a/Gemfile b/Gemfile index 78e3274..b197916 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,4 @@ gemspec gem "rake" gem "rake-compiler" gem "minitest", ">= 5" +gem "ruby_memcheck" diff --git a/Rakefile b/Rakefile index 21f95ce..63807f9 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,18 @@ require "bundler/gem_tasks" require "rake/testtask" require "rake/extensiontask" +require "ruby_memcheck" task default: :test -Rake::TestTask.new do |t| +test_config = lambda do |t| t.libs << "test" t.pattern = "test/**/*_test.rb" end +Rake::TestTask.new(:test, &test_config) + +namespace :test do + RubyMemcheck::TestTask.new(:valgrind, &test_config) +end Rake::ExtensionTask.new("or-tools") do |ext| ext.name = "ext"