diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6e30e29..48c2468 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,11 +10,12 @@ jobs: ruby: ["3.2"] steps: - uses: actions/checkout@v3 + with: + submodules: recursive - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - uses: r-lib/actions/setup-r@v2 - if: matrix.os == 'ubuntu' run: sudo apt-get update -yq && sudo apt-get upgrade -yq - if: matrix.os == 'macos' diff --git a/Rakefile b/Rakefile index cb6fc46..8df0991 100644 --- a/Rakefile +++ b/Rakefile @@ -1,16 +1,37 @@ -require 'bundler/gem_tasks' -require 'rake/testtask' +require "bundler/gem_tasks" +require "rake/testtask" Rake::TestTask.new(:test) do |t| - t.libs << 'test' - t.libs << 'lib' - t.test_files = FileList['test/**/*_test.rb'] + t.libs << "test" + t.libs << "lib" + t.test_files = FileList["test/**/*_test.rb"] end -require 'rake/extensiontask' +require "rake/extensiontask" task build: :compile -Rake::ExtensionTask.new('odgi') do |ext| - ext.lib_dir = 'lib/odgi' +Rake::ExtensionTask.new("odgi") do |ext| + ext.lib_dir = "lib/odgi" +end + +namespace :odgi do + desc "Building odgi" + task :build do + Dir.chdir("odgi") do + sh "cmake -H. -Bbuild" + sh "cmake --build build -- -j #{Etc.nprocessors}" + sh "mkdir -p ../vendor" + if File.exist?("lib/libodgi.a") + sh "cp lib/libodgi.a ../vendor" + elsif File.exist?("build/libodgi.so") + sh "cp lib/libodgi.so ../vendor" + elsif File.exist?("build/libodgi.dylib") + sh "cp lib/libodgi.dylib ../vendor" + else + sh "ls -l lib" + warn "libodgi.a or libodgi.so or libodgi.dylib not found" + end + end + end end