From 0e739363165aaf87cc6119ba02825b8a68eafde5 Mon Sep 17 00:00:00 2001 From: HenrZu <69154294+HenrZu@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:31:35 +0100 Subject: [PATCH 1/2] add MEMILIO_USE_HDF5 option. New CI runs --- .github/actions/linux-build/action.yml | 15 ++++++++++----- .github/actions/linux-test/action.yml | 16 ++++++++++++---- .github/workflows/main.yml | 23 +++++++++++++++++++++++ cpp/README.md | 1 + cpp/thirdparty/CMakeLists.txt | 14 +++++++++----- docs/source/cpp/installation.rst | 2 ++ 6 files changed, 57 insertions(+), 14 deletions(-) diff --git a/.github/actions/linux-build/action.yml b/.github/actions/linux-build/action.yml index 027647f126..603587b53b 100644 --- a/.github/actions/linux-build/action.yml +++ b/.github/actions/linux-build/action.yml @@ -31,6 +31,10 @@ inputs: description: "Enable Multithreading with OpenMP (ON or OFF, default OFF). If ON, adds `-omp` to the name of the artifact." required: false default: "OFF" + hdf5: + description: "Build with HDF5 (ON or OFF, default ON). If OFF, adds `-nohdf5` to the artifact name. If no optional dependencies are built, HDF5 is also not built, even if this option is set to ON." + required: false + default: "ON" runs: using: "composite" steps: @@ -38,10 +42,11 @@ runs: shell: bash run: | sudo apt-get -qq update - sudo apt-get -qq -y install lcov ccache - if [[ "${{ inputs.optional-dependencies }}" == "ON" ]]; then - sudo apt-get -qq -y install libhdf5-dev + HDF5_PACKAGES="" + if [[ "${{ inputs.optional-dependencies }}" == "ON" && "${{ inputs.hdf5 }}" == "ON" ]]; then + HDF5_PACKAGES="libhdf5-dev" fi + sudo apt-get -qq -y install lcov ccache $HDF5_PACKAGES if [[ "${{ inputs.compiler }}" == "gcc" ]]; then if [[ "${{ inputs.version }}" == "min" ]]; then sudo apt-get -qq -y install gcc-11 @@ -97,7 +102,7 @@ runs: exit 1 fi mkdir -p build && cd build - cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} .. + cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} -DMEMILIO_USE_HDF5=${{ inputs.hdf5 }} .. make -j4 - name: create build dir archive shell: bash @@ -108,6 +113,6 @@ runs: uses: actions/upload-artifact@v4 with: #artifacts in one pipeline must have a different name, so options must add a suffix to the artifact name if different values are used in the same pipeline - name: build-cpp-linux-${{ inputs.compiler }}-${{ inputs.version }}-${{ inputs.config }}${{ inputs.optional-dependencies == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}} + name: build-cpp-linux-${{ inputs.compiler }}-${{ inputs.version }}-${{ inputs.config }}${{ inputs.optional-dependencies == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}} path: cpp/build.tar.gz retention-days: 1 diff --git a/.github/actions/linux-test/action.yml b/.github/actions/linux-test/action.yml index 2ae4d5c860..dcfdac3d49 100644 --- a/.github/actions/linux-test/action.yml +++ b/.github/actions/linux-test/action.yml @@ -20,6 +20,10 @@ inputs: description: "Enabled Multithreading with OpenMP (ON or OFF, default OFF). If ON, adds `-omp` to the name of the artifact." required: false default: "OFF" + hdf5: + description: "Build with HDF5 (ON or OFF, default ON). If OFF, adds `-nohdf5` to the artifact name. If no optional dependencies are built, HDF5 is also not built, even if this option is set to ON." + required: false + default: "ON" runs: using: "composite" steps: @@ -27,12 +31,16 @@ runs: shell: bash run: | sudo apt-get -qq update - sudo apt-get -qq -y install libhdf5-10* wget gnupg lcov + HDF5_PACKAGES="" + if [[ "${{ inputs.optional-deps }}" == "ON" && "${{ inputs.hdf5 }}" == "ON" ]]; then + HDF5_PACKAGES="libhdf5-10*" + fi + sudo apt-get -qq -y install wget gnupg lcov $HDF5_PACKAGES sudo apt-get -qq update - name: Download built test directory uses: actions/download-artifact@v4 with: - name: build-cpp-linux-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}} + name: build-cpp-linux-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}} path: cpp - name: extract build archive shell: bash @@ -58,14 +66,14 @@ runs: - name: Upload test report uses: actions/upload-artifact@v4 with: - name: test-cpp-linux-report-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}} + name: test-cpp-linux-report-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}} path: cpp/build/bin/report.xml if-no-files-found: error retention-days: 1 - name: Upload coverage reports uses: actions/upload-artifact@v4 with: - name: test-cpp-coverage-reports-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}} + name: test-cpp-coverage-reports-${{ inputs.artifact-pattern }}${{ inputs.optional-deps == 'OFF' && '-nodep' || ''}}${{ inputs.openmp == 'ON' && '-omp' || ''}}${{ inputs.hdf5 == 'OFF' && '-nohdf5' || ''}} path: | cpp/build/coverage.info cpp/build/coverage diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b87795d7bd..783e710206 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,6 +66,18 @@ jobs: config: Release optional-dependencies: OFF + build-cpp-gcc-no-hdf5: + if: github.event.pull_request.draft == false + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/linux-build + with: + compiler: gcc + version: latest + config: Release + hdf5: OFF + build-cpp-gcc-openmp: if: github.event.pull_request.draft == false runs-on: ubuntu-latest @@ -162,6 +174,17 @@ jobs: name: test-py-coverage-reports-surrogatemodel pattern: test-py-coverage-reports-surrogatemodel-* + test-cpp-gcc-no-hdf5: + if: github.event.pull_request.draft == false + needs: build-cpp-gcc-no-hdf5 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/linux-test + with: + artifact-pattern: gcc-latest-Release + hdf5: OFF + test-cpp-gcc-no-optional-deps: if: github.event.pull_request.draft == false needs: build-cpp-gcc-no-optional-deps diff --git a/cpp/README.md b/cpp/README.md index 4039380ffa..746fe8002c 100644 --- a/cpp/README.md +++ b/cpp/README.md @@ -55,6 +55,7 @@ Options can be specified with `cmake .. -D