From 1996e35d9ee6a85683775ac1c5647da332026c04 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Sat, 7 Sep 2024 21:08:30 +0900 Subject: [PATCH] Update CI --- .github/workflows/main.yml | 27 --------------------------- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++++++ lib/hdf5.rb | 5 ++--- 3 files changed, 36 insertions(+), 30 deletions(-) delete mode 100644 .github/workflows/main.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 935871d..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Ruby - -on: - push: - pull_request: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - name: Ruby ${{ matrix.ruby }} - strategy: - matrix: - ruby: - - '3.2.0' - - steps: - - uses: actions/checkout@v3 - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - bundler-cache: true - - name: Install hdf5 - run: sudo apt-get install libhdf5-dev - - name: Run the default task - run: bundle exec rake diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..9bf6b08 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: test + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + runs-on: ${{ matrix.os }}-latest + name: ${{ matrix.os }} ruby ${{ matrix.ruby }} + strategy: + matrix: + os: [ubuntu, macos] + ruby: [3.2, 3.3] + + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - if: matrix.os == 'ubuntu' + name: Install hdf5 - Ubuntu + run: sudo apt-get install libhdf5-dev + - if: matrix.os == 'macos' + name: Install hdf5 - MacOS + run: brew install hdf5@1.10 + - if: matrix.os == 'ubuntu' + name: Run test - Ubuntu + run: bundle exec rake test + - if: matrix.os == 'macos' + name: Run test - MacOS + run: bundle exec rake test + env: + HDF5_LIB_PATH: /opt/homebrew/Cellar/hdf5@1.10/1.10.11/lib diff --git a/lib/hdf5.rb b/lib/hdf5.rb index 980b334..1cf1583 100644 --- a/lib/hdf5.rb +++ b/lib/hdf5.rb @@ -9,10 +9,9 @@ class Error < StandardError; end class << self attr_accessor :lib_path - def search_hdf5lib(name = nil) - return File.expand_path(name, ENV['HDF5_LIB_PATH']) if ENV['HDF5_LIB_PATH'] - + def search_hdf5lib name = "libhdf5.#{FFI::Platform::LIBSUFFIX}" + return File.expand_path(name, ENV['HDF5_LIB_PATH']) if ENV['HDF5_LIB_PATH'] begin require 'pkg-config'