Skip to content

add: support for std::mdspan. #279

add: support for std::mdspan.

add: support for std::mdspan. #279

Workflow file for this run

name: Unit Tests
# See, scorecard.dev (Token Permission)
# https://github.com/ossf/scorecard/blob/a16e0f9eb245274f08512e33dc7afa78d21c460c/docs/checks.md#token-permissions
permissions: read-all
concurrency:
group: ${{ github.workflow }}#${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'main' }}
on:
workflow_dispatch:
push:
branches:
- master
- main
- v2.x
pull_request:
branches:
- master
- main
- v2.x
paths-ignore:
- '**.md'
- '**.rst'
- 'doc/**'
env:
HOMEBREW_NO_AUTO_UPDATE: 1 # for reproducibility, dont autoupdate
BUILD_TYPE: RelWithDebInfo
INSTALL_DIR: install
jobs:
# Job testing compiling on several Ubuntu systems + MPI
# =========================================================
#
# XTensor tests are run for conda/mamba and MacOS
Linux_MPI:
runs-on: ${{matrix.config.os}}
name: Linux_MPI (${{toJson(matrix.config)}})
strategy:
matrix:
include:
- config:
os: ubuntu-24.04
pkgs: ''
- config:
os: ubuntu-22.04
pkgs: 'libboost-all-dev libopencv-dev'
flags: '-DHIGHFIVE_TEST_BOOST:Bool=ON -DHIGHFIVE_TEST_OPENCV:Bool=ON -GNinja'
- config:
os: ubuntu-24.04
pkgs: 'libboost-all-dev libeigen3-dev libopencv-dev'
flags: '-DHIGHFIVE_TEST_BOOST:Bool=ON -DHIGHFIVE_TEST_EIGEN:Bool=ON -DHIGHFIVE_TEST_OPENCV:Bool=ON -GNinja'
- config:
os: ubuntu-24.04
pkgs: 'libboost-all-dev'
flags: '-DCMAKE_CXX_STANDARD=17 -DHIGHFIVE_TEST_BOOST:Bool=ON'
- config:
os: ubuntu-24.04
flags: '-DHIGHFIVE_TEST_BOOST=Off -DCMAKE_CXX_STANDARD=20'
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Setup MPI"
uses: mpi4py/setup-mpi@v1
with:
mpi: openmpi
- name: "Install libraries"
run: |
sudo apt-get -qq update
sudo apt-get -qq install libhdf5-openmpi-dev libsz2 ninja-build ${{ matrix.config.pkgs }}
- name: Build
run: |
CMAKE_OPTIONS=(-DHDF5_PREFER_PARALLEL:BOOL=ON ${{ matrix.config.flags }})
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG
- name: Examples
working-directory: ${{github.workspace}}/build/src/examples
run: $GITHUB_WORKSPACE/.github/run_examples.sh
# Job testing several versions of hdf5
# ===================================================
Linux_HDF5_Versions:
runs-on: ubuntu-latest
strategy:
matrix:
hdf5_version : [ hdf5-1_8_23, hdf5-1_10_11, hdf5-1_12_3, hdf5_1.14.6, hdf5_2.0.0]
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Install libraries"
run: |
sudo apt-get -qq update
sudo apt-get -qq install ninja-build libsz2 zlib1g-dev libboost-all-dev
- name: Build HDF5
run: |
wget https://github.com/HDFGroup/hdf5/archive/refs/tags/${{ matrix.hdf5_version }}.tar.gz --output-document hdf5.tar.gz
tar xf hdf5.tar.gz
mkdir -p hdf5-${{ matrix.hdf5_version }}/BUILD && cd hdf5-${{ matrix.hdf5_version }}/BUILD
cmake .. -DCMAKE_BUILD_TYPE=Release -GNinja -DCMAKE_INSTALL_PREFIX=$HOME/${{ matrix.hdf5_version }} -DHDF5_ENABLE_ZLIB_SUPPORT=ON -DHDF5_ENABLE_Z_LIB_SUPPORT=ON -DUSE_LIBAEC=ON -DHDF5_BUILD_EXAMPLES=OFF -DBUILD_STATIC_LIBS=OFF -DBUILD_TESTING=OFF
ninja && ninja install
- name: Build
run: |
CMAKE_OPTIONS=(
-GNinja
-DHDF5_ROOT=$HOME/${{ matrix.hdf5_version }}
)
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG
- name: Examples
working-directory: ${{github.workspace}}/build/src/examples
run: $GITHUB_WORKSPACE/.github/run_examples.sh
# Job testing several compilers on a stable Linux
# ====================================================
Linux_Compilers:
runs-on: ${{matrix.os}}
env: ${{ matrix.env }}
strategy:
matrix:
os: [ "ubuntu-24.04" ]
env: [
{CC: clang-18, CXX: clang++-18, pkgs: "clang-18"},
{CC: gcc-9, CXX: g++-9, pkgs: "gcc-9 g++-9"},
{CC: gcc-14, CXX: g++-14, pkgs: "gcc-14 g++-14"},
]
include:
- os: "ubuntu-22.04"
env:
CC: clang-11
CXX: clang++-11
pkgs: clang-11
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Install libraries"
run: |
sudo apt-get -qq update
sudo apt-get -qq install ${pkgs}
sudo apt-get -qq install libboost-all-dev libhdf5-dev libsz2 ninja-build
- name: Build
run: |
CMAKE_OPTIONS=(-DHIGHFIVE_TEST_BOOST=ON -GNinja)
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG
- name: Examples
working-directory: ${{github.workspace}}/build/src/examples
run: $GITHUB_WORKSPACE/.github/run_examples.sh
# Job testing clang with C++23, libc++ and MDSPAN
# ================================================
Linux_Clang_CXX23_MDSPAN:
runs-on: ubuntu-24.04
env:
CC: clang-21
CXX: clang++-21
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Add LLVM repository"
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-snapshot.gpg
echo "deb [signed-by=/usr/share/keyrings/llvm-snapshot.gpg] http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list
- name: "Install libraries"
run: |
sudo apt-get -qq update
sudo apt-get -qq install clang-21 libc++-21-dev libc++abi-21-dev libhdf5-dev libsz2 ninja-build
- name: Build
run: |
CMAKE_OPTIONS=(
-GNinja
-DCMAKE_CXX_STANDARD=23
-DHIGHFIVE_USE_LIBCXX:BOOL=ON
-DHIGHFIVE_TEST_MDSPAN:BOOL=ON
)
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG
- name: Examples
working-directory: ${{github.workspace}}/build/src/examples
run: $GITHUB_WORKSPACE/.github/run_examples.sh
# Job running unit-test with sanitizers
# =====================================
Linux_Sanitizers:
runs-on: ubuntu-24.04
strategy:
matrix:
env: [
{CC: clang, CXX: clang++, HIGHFIVE_SANITIZER: address},
{CC: clang, CXX: clang++, HIGHFIVE_SANITIZER: undefined},
{CC: gcc, CXX: g++, HIGHFIVE_GLIBCXX_ASSERTIONS: On},
]
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Install libraries"
run: |
sudo apt-get -qq update
sudo apt-get -qq install boost1.83 libeigen3-dev libhdf5-dev libsz2 ninja-build
- name: Build
run: |
CMAKE_OPTIONS=(
-GNinja
-DHIGHFIVE_TEST_BOOST:BOOL=ON
-DHIGHFIVE_TEST_BOOST_SPAN:BOOL=ON
-DHIGHFIVE_TEST_EIGEN:BOOL=ON
-DHIGHFIVE_BUILD_DOCS:BOOL=FALSE
-DHIGHFIVE_GLIBCXX_ASSERTIONS=${HIGHFIVE_GLIBCXX_ASSERTIONS:-OFF}
-DHIGHFIVE_SANITIZER=${HIGHFIVE_SANITIZER:-OFF}
)
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG
- name: Examples
working-directory: ${{github.workspace}}/build/src/examples
run: $GITHUB_WORKSPACE/.github/run_examples.sh
# Job to check using HighFive from other CMake projects
# =====================================================
CMake_Project:
runs-on: ubuntu-24.04
strategy:
matrix:
parallelism: [ serial, parallel ]
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Update Ubuntu"
run: |
sudo apt-get -qq update
- name: "Install common libraries"
run: |
sudo apt-get -qq install libboost-all-dev libsz2 ninja-build
- name: "Install serial HDF5"
if: matrix.parallelism == 'serial'
run: |
sudo apt-get -qq install libhdf5-dev
- name: "Install parallel HDF5"
if: matrix.parallelism == 'parallel'
run: |
sudo apt-get -qq install libhdf5-openmpi-dev
- name: "CMake Project Integration"
run: bash tests/cmake_integration/test_cmake_integration.sh
# Job testing in OSX
# ==================
OSX:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ "macOS-15" ]
cxxstd: ["14", "17", "20", "23"]
include:
- os: "macOS-14"
cxxstd: "14"
steps:
- uses: actions/checkout@v5
with:
submodules: true
- name: "Install libraries (OSX)"
run: brew install boost eigen hdf5 ninja xtensor
- name: Build
run: |
if (( ${{ matrix.cxxstd }} > 14 ))
then
TEST_XTENSOR=On
else
TEST_XTENSOR=Off
fi
CMAKE_OPTIONS=(
-GNinja
-DHIGHFIVE_HAS_WERROR:BOOL=ON
-DHIGHFIVE_TEST_BOOST:BOOL=ON
-DHIGHFIVE_TEST_EIGEN:BOOL=ON
-DHIGHFIVE_TEST_XTENSOR:BOOL=${TEST_XTENSOR}
-DHIGHFIVE_BUILD_DOCS:BOOL=FALSE
-DCMAKE_CXX_STANDARD=${{matrix.cxxstd}}
)
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG
- name: Examples
working-directory: ${{github.workspace}}/build/src/examples
run: $GITHUB_WORKSPACE/.github/run_examples.sh
# Job testing in Windows
# ======================
Windows:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ "windows-2022", "windows-2025"]
cxxstd: ["14", "17", "20"]
steps:
- uses: actions/checkout@v5
with:
submodules: true
- uses: mamba-org/setup-micromamba@v2
with:
environment-file: .github/mamba_env_cxx${{matrix.cxxstd}}.yaml
environment-name: win-test
- name: Build
shell: bash -l {0}
run: |
if (( ${{ matrix.cxxstd }} == 17 ))
then
XTENSOR_HEADER_VERSION=2
else
# Both C++14 and C++20 use 0.26
XTENSOR_HEADER_VERSION=1
fi
CMAKE_OPTIONS=(
-DCMAKE_CXX_STANDARD=${{matrix.cxxstd}}
-DHIGHFIVE_UNIT_TESTS=ON
-DHIGHFIVE_TEST_BOOST:BOOL=ON
-DHIGHFIVE_TEST_EIGEN:BOOL=ON
-DHIGHFIVE_TEST_XTENSOR:BOOL=ON
-DHIGHFIVE_XTENSOR_HEADER_VERSION=$XTENSOR_HEADER_VERSION
)
source $GITHUB_WORKSPACE/.github/build.sh
- name: Test
working-directory: ${{github.workspace}}/build
shell: bash -l {0}
run: |
ctest -j2 --output-on-failure -C $BUILD_TYPE
- name: Test No HDF5 Diagnositics
working-directory: ${{github.workspace}}/build
shell: bash -l {0}
run: |
! ctest --verbose -C $BUILD_TYPE | grep HDF5-DIAG