diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ef5fc4..f2a6027 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,5 +21,6 @@ jobs: with: ruby-version: ${{ matrix.ruby }} bundler-cache: true + - run: sudo apt-get update && sudo apt-get install valgrind - run: MAKE="make -j$(nproc)" bundle exec rake compile - run: bundle exec rake test 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 1cbf0e1..37f48f8 100644 --- a/Rakefile +++ b/Rakefile @@ -1,13 +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" t.warning = false end +Rake::TestTask.new(:test, &test_config) +namespace :test do + RubyMemcheck::TestTask.new(:valgrind, &test_config) +end Rake::ExtensionTask.new("faiss") do |ext| ext.name = "ext"