fix: support HDF5 1.10.4 with graceful degradation (#21) (#22) #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # HDF5 library path for runtime loading on Ubuntu | |
| LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu/hdf5/serial | |
| jobs: | |
| lint: | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| # Note: HDF5 not needed for lint - runtime-loading mode uses dlopen | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run clippy | |
| run: cargo clippy --workspace -- -D warnings -A clippy::multiple-crate-versions | |
| test: | |
| name: test (${{ matrix.os }}, HDF5 ${{ matrix.hdf5 }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Ubuntu with conda HDF5 1.10.4 (minimum supported version) | |
| - os: ubuntu-22.04 | |
| hdf5: "1.10.4" | |
| hdf5_source: "conda" | |
| # Ubuntu with system HDF5 1.10.x (apt, typically 1.10.7) | |
| - os: ubuntu-22.04 | |
| hdf5: "1.10" | |
| hdf5_source: "apt" | |
| # Ubuntu with conda HDF5 1.12.x | |
| - os: ubuntu-22.04 | |
| hdf5: "1.12" | |
| hdf5_source: "conda" | |
| # Ubuntu with conda HDF5 1.14.x | |
| - os: ubuntu-24.04 | |
| hdf5: "1.14" | |
| hdf5_source: "conda" | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install HDF5 from apt (1.10.x) | |
| if: matrix.hdf5_source == 'apt' | |
| run: sudo apt-get update && sudo apt-get install -y libhdf5-dev | |
| - name: Setup Conda | |
| if: matrix.hdf5_source == 'conda' | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| python-version: "3.11" | |
| - name: Install HDF5 from conda-forge | |
| if: matrix.hdf5_source == 'conda' | |
| shell: bash -el {0} | |
| run: conda install -c conda-forge "hdf5>=${{ matrix.hdf5 }},<${{ matrix.hdf5 }}.99" | |
| - name: Set HDF5 library path (conda) | |
| if: matrix.hdf5_source == 'conda' | |
| shell: bash -el {0} | |
| run: echo "LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| - name: Show HDF5 version | |
| shell: bash -el {0} | |
| run: | | |
| if command -v h5dump &> /dev/null; then | |
| h5dump --version | |
| else | |
| echo "h5dump not in PATH, checking library..." | |
| find /usr -name "libhdf5*.so*" 2>/dev/null | head -5 || true | |
| fi | |
| - name: Run tests | |
| shell: bash -el {0} | |
| run: cargo test --workspace --all-features --verbose | |
| macos: | |
| name: macOS | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install HDF5 | |
| run: brew install hdf5 | |
| - name: Set HDF5 environment | |
| run: | | |
| HDF5_PREFIX=$(brew --prefix hdf5) | |
| echo "HDF5_DIR=${HDF5_PREFIX}" >> $GITHUB_ENV | |
| - name: Build and test | |
| run: cargo test --workspace --verbose | |
| interop-julia: | |
| name: Julia interop | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Install Julia | |
| uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: '1.11' | |
| - name: Setup Julia project | |
| run: | | |
| cd tests/julia | |
| julia --project=. -e 'using Pkg; Pkg.instantiate()' | |
| - name: Run Julia interop tests | |
| run: | | |
| cd tests/julia | |
| julia --project=. test_interop.jl | |
| interop-python: | |
| name: Python interop | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup Conda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| auto-update-conda: true | |
| python-version: "3.11" | |
| - name: Install HDF5 1.12+ and h5py from conda-forge | |
| shell: bash -el {0} | |
| run: conda install -c conda-forge hdf5>=1.12 h5py | |
| - name: Set HDF5 library path | |
| shell: bash -el {0} | |
| run: echo "LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| - name: Install Python dependencies | |
| shell: bash -el {0} | |
| run: | | |
| pip install -r tests/python/requirements.txt | |
| - name: Run Python interop tests | |
| shell: bash -el {0} | |
| run: | | |
| python tests/python/test_interop.py |