diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0b89fed..834d603 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,12 +9,6 @@ jobs: include: - ruby: 3.3 os: ubuntu-22.04 - - ruby: 3.2 - os: ubuntu-22.04 - - ruby: 3.1 - os: ubuntu-20.04 - - ruby: "3.0" - os: ubuntu-20.04 env: LIBTORCH_VERSION: 2.2.1 steps: @@ -35,4 +29,5 @@ jobs: wget -q -O libtorch.zip https://download.pytorch.org/libtorch/cpu/libtorch-cxx11-abi-shared-with-deps-$LIBTORCH_VERSION%2Bcpu.zip unzip -q libtorch.zip - run: MAKE="make -j$(nproc)" bundle exec rake compile -- --with-torch-dir=$HOME/libtorch - - run: bundle exec rake test + - run: sudo apt-get update && sudo apt-get install valgrind + - run: bundle exec rake test:valgrind diff --git a/Gemfile b/Gemfile index b725171..3251102 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,7 @@ gem "rake" gem "rake-compiler" gem "minitest", ">= 5" gem "numo-narray" +gem "ruby_memcheck" # for examples gem "torchvision", ">= 0.2", require: false diff --git a/Rakefile b/Rakefile index 34f3ff2..3dca72e 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("torch") do |ext| ext.name = "ext"