hdf5 0.7.0

Thread-safe Rust bindings for the HDF5 library.
Documentation
name: CI

on:
  push:
  pull_request:
    branches:
      - master
  schedule:
    - cron: '0 18 * * *'

env:
  CARGO_TERM_COLOR: always

jobs:
  lint:
    name: lint
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - {command: fmt, rust: nightly}
          - {command: clippy, rust: stable}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Install Rust (${{matrix.rust}})
        uses: actions-rs/toolchain@v1
        with: {profile: minimal, toolchain: '${{matrix.rust}}', override: true, components: 'rustfmt, clippy'}
      - name: Install HDF5
        run: sudo apt-get install libhdf5-dev
      - name: Run cargo ${{matrix.command}}
        uses: actions-rs/cargo@v1
        with:
          command: ${{matrix.command}}
          args: "${{matrix.command == 'fmt' && '--all -- --check' || '-- -D warnings'}}"

  brew:
    name: brew
    runs-on: macos-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - {version: hdf5@1.8}
          - {version: hdf5@1.10}
          - {version: hdf5@1.12}
          - {version: hdf5-mpi, mpi: true}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with: {submodules: true}
      - name: Install Rust (${{matrix.rust}})
        uses: actions-rs/toolchain@v1
        with: {toolchain: stable, profile: minimal, override: true}
      - name: Install HDF5 (${{matrix.version}})
        run: brew install ${{matrix.version}}
      - name: Build and test all crates
        run: |
          [ "${{matrix.mpi}}" != "" ] && FEATURES=mpio
          cargo test -vv --features="$FEATURES"

  conda:
    name: conda
    runs-on: ${{matrix.os}}-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - {os: ubuntu, version: 1.8.16, channel: conda-forge, rust: stable}
          - {os: windows, version: 1.8.17, channel: conda-forge, rust: stable}
          - {os: macos, version: 1.8.18, channel: anaconda, rust: stable}
          - {os: ubuntu, version: 1.8.20, channel: anaconda, rust: beta}
          - {os: ubuntu, version: 1.10.1, channel: anaconda, rust: nightly}
          - {os: windows, version: 1.10.2, channel: anaconda, rust: beta}
          - {os: ubuntu, version: 1.10.3, channel: conda-forge, rust: nightly}
          - {os: windows, version: 1.10.4, channel: anaconda, rust: nightly}
          - {os: ubuntu, version: 1.10.4, mpi: openmpi, channel: conda-forge, rust: stable}
          - {os: ubuntu, version: 1.10.5, channel: conda-forge, rust: beta}
          - {os: macos, version: 1.10.5, mpi: openmpi, channel: conda-forge, rust: beta}
          - {os: ubuntu, version: 1.10.6, channel: anaconda, rust: stable}
          - {os: ubuntu, version: 1.10.6, mpi: mpich, channel: conda-forge, rust: nightly}
          - {os: ubuntu, version: 1.12.0, mpi: openmpi, channel: conda-forge, rust: stable}
          - {os: macos, version: 1.12.0, channel: conda-forge, rust: stable}
          - {os: windows, version: 1.12.0, channel: conda-forge, rust: stable}
    defaults:
      run:
        shell: bash -l {0}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with: {submodules: true}
      - name: Install Rust (${{matrix.rust}})
        uses: actions-rs/toolchain@v1
        with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true}
      - name: Install conda
        uses: goanpeca/setup-miniconda@v1
        with: {auto-update-conda: false, activate-environment: testenv}
      - name: Install HDF5 (${{matrix.version}}${{matrix.mpi && '-' || ''}}${{matrix.mpi}})
        run: |
          [ "${{matrix.mpi}}" != "" ] && MPICC_PKG=${{matrix.mpi}}-mpicc
          conda install -y -c ${{matrix.channel}} 'hdf5=${{matrix.version}}=*${{matrix.mpi}}*' $MPICC_PKG
      - name: Build and test all crates
        run: |
          export HDF5_DIR="$CONDA_PREFIX"
          [ "${{matrix.mpi}}" != "" ] && FEATURES=mpio
          [ "${{runner.os}}" != "Windows" ] && export RUSTFLAGS="-C link-args=-Wl,-rpath,$CONDA_PREFIX/lib"
          [ "${{matrix.mpi}}" == "mpich" ] && [ "${{runner.os}}" == "Linux" ] && export MPICH_CC=$(which gcc)
          [ "${{matrix.mpi}}" == "openmpi" ] && [ "${{runner.os}}" == "Linux" ] && export OMPI_CC=$(which gcc)
          cargo test -vv --features="$FEATURES"

  static:
    name: static
    runs-on: ${{matrix.os}}-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - {os: ubuntu, rust: stable}
          - {os: windows, rust: stable-msvc}
          - {os: windows, rust: stable-gnu}
          - {os: macos, rust: stable}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with: {submodules: true}
      - name: Install Rust (${{matrix.rust}})
        uses: actions-rs/toolchain@v1
        with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true}
      - name: Build and test all crates
        run: cargo test --workspace -v --features hdf5-sys/static,hdf5-sys/zlib --exclude hdf5-derive

  apt:
    name: apt
    runs-on: ubuntu-${{matrix.ubuntu}}
    strategy:
      fail-fast: false
      matrix:
        include:
          - {ubuntu: 16.04, mpi: serial, rust: nightly}
          - {ubuntu: 18.04, mpi: mpich, rust: beta}
          - {ubuntu: 20.04, mpi: openmpi, rust: stable}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with: {submodules: true}
      - name: Install Rust (${{matrix.rust}})
        uses: actions-rs/toolchain@v1
        with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true}
      - name: Install HDF5 (${{matrix.mpi}})
        run: |
          [ "${{matrix.mpi}}" == "mpich" ] && PACKAGES="libhdf5-mpich-dev mpich"
          [ "${{matrix.mpi}}" == "openmpi" ] && PACKAGES="libhdf5-openmpi-dev openmpi-bin"
          [ "${{matrix.mpi}}" == "serial" ] && PACKAGES="libhdf5-dev"
          sudo apt-get install $PACKAGES
      - name: Build and test all crates
        run: |
          [ "${{matrix.mpi}}" != "serial" ] && FEATURES=mpio
          cargo test -vv --features="$FEATURES"

  msi:
    name: msi
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        rust: [stable]
        version: [1.8, '1.10']
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
        with: {submodules: true}
      - name: Install Rust (${{matrix.rust}})
        uses: actions-rs/toolchain@v1
        with: {toolchain: '${{matrix.rust}}', profile: minimal, override: true}
      - name: Configure environment
        shell: bash
        run: |
          if [ "${{matrix.version}}" == "1.8" ]; then
            VERSION=1.8.21
            DL_PATH=hdf5-1.8.21-Std-win7_64-vs14.zip
            echo ::set-env name=MSI_PATH::hdf\\HDF5-1.8.21-win64.msi
          else
            VERSION=1.10.0
            DL_PATH=windows/extra/hdf5-1.10.0-win64-VS2015-shared.zip
            echo ::set-env name=MSI_PATH::hdf5\\HDF5-1.10.0-win64.msi
          fi
          BASE_URL=https://support.hdfgroup.org/ftp/HDF5/prev-releases
          echo ::set-env name=DL_URL::$BASE_URL/hdf5-${{matrix.version}}/hdf5-$VERSION/bin/$DL_PATH
          echo ::add-path::C:\\Program Files\\HDF_Group\\HDF5\\$VERSION\\bin
      - name: Install HDF5 (${{matrix.version}})
        shell: pwsh
        run: |
          C:\msys64\usr\bin\wget.exe -q -O hdf5.zip ${{env.DL_URL}}
          7z x hdf5.zip -y
          msiexec /i ${{env.MSI_PATH}} /quiet /qn /norestart
      - name: Build and test all crates
        run: cargo test -vv