From 8fc5a7b659f7e2d4887edc0d166e3be2da872458 Mon Sep 17 00:00:00 2001 From: Jan Breuer Date: Tue, 3 Dec 2024 09:50:50 +0100 Subject: [PATCH] Add release tests with separate workflow The added `cd` workflow for now only builds CADET and executes dedicated tests that are too extensive for the CI but should be tested before releasing a new version. --- .github/workflows/cd.yml | 59 +++++++++++++++++++++ doc/developer_guide/release_new_version.rst | 2 +- doc/developer_guide/testing.rst | 2 +- test/GeneralRateModel.cpp | 5 +- test/LumpedRateModelWithPores.cpp | 4 +- test/LumpedRateModelWithoutPores.cpp | 4 +- test/UnitOperationTests.cpp | 2 + 7 files changed, 70 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 000000000..575e933e6 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,59 @@ +name: CD tests + +on: + workflow_dispatch: + inputs: + ref: + description: 'Commit hash, branch name, or tag to run the CD pipeline for' + required: false + default: 'HEAD' + type: string + + +jobs: + Ubuntu-latest: + runs-on: ubuntu-latest + strategy: + fail-fast: true + defaults: + run: + shell: bash -l {0} + env: + SRC_DIR: ${{ github.workspace }}/src + BUILD_DIR: ${{ github.workspace }}/build + INSTALL_PREFIX: ${{ github.workspace }}/install + BUILD_TYPE: Release + steps: + - uses: actions/checkout@v4 + with: + submodules: true + path: src + ref: ${{ github.event.inputs.ref || github.ref }} + - name: Install Dependencies + run: | + sudo apt-get update + sudo apt -y install \ + build-essential \ + libhdf5-dev \ + liblapack-dev \ + libblas-dev \ + libtbb-dev \ + libsuperlu-dev \ + libeigen3-dev; + - name: Build and Install + run: | + cmake -E make_directory "${BUILD_DIR}" + cmake -E make_directory "${INSTALL_PREFIX}" + cd "${BUILD_DIR}" + cmake -DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" "${SRC_DIR}" -DENABLE_TESTS=ON -DNUM_MAX_AD_DIRS=1320 + make install -j$(nproc) + - name: Check if it runs + run: | + export LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:$LD_LIBRARY_PATH + ${INSTALL_PREFIX}/bin/cadet-cli --version || true + ${INSTALL_PREFIX}/bin/createLWE + ${INSTALL_PREFIX}/bin/cadet-cli LWE.h5 || true + - name: Run tests + run: | + ${BUILD_DIR}/test/testRunner [ReleaseCI] + diff --git a/doc/developer_guide/release_new_version.rst b/doc/developer_guide/release_new_version.rst index 6b07008d8..5ecefd564 100644 --- a/doc/developer_guide/release_new_version.rst +++ b/doc/developer_guide/release_new_version.rst @@ -12,7 +12,7 @@ Release checklist - The release tests contain extensive testing that is not included in our CI, such as EOC tests. Running these tests might take a while and this should be done on the server. - - Some tests are implemented in CADET-Core, and can be run with the [ReleaseCI] flag. + - Some tests are implemented in CADET-Core with a `ReleaseCI` flag, which should be run by executing the ci workflow. - More tests are implemented in Python, the code can be found in `CADET-Verification `_ Compare the results with the previous run. The release process can only be continued if the results are reasonable. diff --git a/doc/developer_guide/testing.rst b/doc/developer_guide/testing.rst index b0473a686..8d6ea0e64 100644 --- a/doc/developer_guide/testing.rst +++ b/doc/developer_guide/testing.rst @@ -91,7 +91,7 @@ This way, we make sure that ongoing CADET-Core development doesnt break the mode **4. Add EOC tests to CADET-Core (optional):** These tests should be part of the paper publication which introduces the new model implemented in CADET-Core and can also be included in the CADET-Core tests. Verifying the experimental order of convergence (EOC) is widely considered the most rigorous and best scientific practice in model and method validation, which is why we recommend including the EOC tables in your publication. -The convergence tests should not be added to the standard CI but only be rerun on release, i.e. by adding the [releaseCI] flag. +The convergence tests should not be added to the standard CI but only be rerun on release, i.e. by adding the [ReleaseCI] flag. Details on how to compute EOC tables can be found elsewhere, please also refer to the already implemented EOC tests in CADET-Verification. Manufactured solution diff --git a/test/GeneralRateModel.cpp b/test/GeneralRateModel.cpp index 47a343eff..409d63653 100644 --- a/test/GeneralRateModel.cpp +++ b/test/GeneralRateModel.cpp @@ -81,7 +81,8 @@ TEST_CASE("GRM numerical Benchmark with parameter sensitivities for SMA LWE case cadet::test::column::testReferenceBenchmark(modelFilePath, refFilePath, "000", absTol, relTol, disc, true); } -TEST_CASE("GRM numerical EOC Benchmark with parameter sensitivities for linear case", "[GRM],[FV],[releaseCI],[EOC],[EOC_GRM_FV]") +// Note that more extensive EOC tests are now part of CADET-Verification +TEST_CASE("GRM numerical EOC Benchmark with parameter sensitivities for linear case", "[GRM],[FV],[EOC],[EOC_GRM_FV]") { const std::string& modelFilePath = std::string("/data/model_GRM_dynLin_1comp_benchmark1.json"); const std::string& refFilePath = std::string("/data/ref_GRM_dynLin_1comp_sensbenchmark1_FV_Z1024parZ128.h5"); @@ -93,7 +94,7 @@ TEST_CASE("GRM numerical EOC Benchmark with parameter sensitivities for linear c cadet::test::column::testEOCReferenceBenchmark(modelFilePath, refFilePath, convFilePath, "001", absTol, relTol, 3, disc, true); } -TEST_CASE("GRM numerical EOC Benchmark with parameter sensitivities for SMA LWE case", "[GRM],[FV],[releaseCI],[EOC],[EOC_GRM_FV]") +TEST_CASE("GRM numerical EOC Benchmark with parameter sensitivities for SMA LWE case", "[GRM],[FV],[EOC],[EOC_GRM_FV]") { const std::string& modelFilePath = std::string("/data/model_GRM_reqSMA_4comp_benchmark1.json"); const std::string& refFilePath = std::string("/data/ref_GRM_reqSMA_4comp_sensbenchmark1_FV_Z512parZ64.h5"); diff --git a/test/LumpedRateModelWithPores.cpp b/test/LumpedRateModelWithPores.cpp index daae805b3..b22ad2aaa 100644 --- a/test/LumpedRateModelWithPores.cpp +++ b/test/LumpedRateModelWithPores.cpp @@ -81,7 +81,7 @@ TEST_CASE("LRMP numerical Benchmark with parameter sensitivities for SMA LWE cas cadet::test::column::testReferenceBenchmark(modelFilePath, refFilePath, "000", absTol, relTol, disc, true); } -TEST_CASE("LRMP numerical EOC Benchmark with parameter sensitivities for linear case", "[releaseCI],[EOC],[EOC_LRMP_FV]") +TEST_CASE("LRMP numerical EOC Benchmark with parameter sensitivities for linear case", "[LRMP],[FV],[EOC],[EOC_LRMP_FV]") { const std::string& modelFilePath = std::string("/data/model_LRMP_dynLin_1comp_benchmark1.json"); const std::string& refFilePath = std::string("/data/ref_LRMP_dynLin_1comp_sensbenchmark1_FV_Z32768.h5"); @@ -93,7 +93,7 @@ TEST_CASE("LRMP numerical EOC Benchmark with parameter sensitivities for linear cadet::test::column::testEOCReferenceBenchmark(modelFilePath, refFilePath, convFilePath, "001", absTol, relTol, 4, disc, true); } -TEST_CASE("LRMP numerical EOC Benchmark with parameter sensitivities for SMA LWE case", "[releaseCI],[EOC],[EOC_LRMP_FV]") +TEST_CASE("LRMP numerical EOC Benchmark with parameter sensitivities for SMA LWE case", "[LRMP],[FV],[EOC],[EOC_LRMP_FV]") { const std::string& modelFilePath = std::string("/data/model_LRMP_reqSMA_4comp_benchmark1.json"); const std::string& refFilePath = std::string("/data/ref_LRMP_reqSMA_4comp_sensbenchmark1_FV_Z2048.h5"); diff --git a/test/LumpedRateModelWithoutPores.cpp b/test/LumpedRateModelWithoutPores.cpp index 2d80adea7..a4b9d6815 100644 --- a/test/LumpedRateModelWithoutPores.cpp +++ b/test/LumpedRateModelWithoutPores.cpp @@ -80,7 +80,7 @@ TEST_CASE("LRM numerical Benchmark with parameter sensitivities for SMA LWE case cadet::test::column::testReferenceBenchmark(modelFilePath, refFilePath, "000", absTol, relTol, disc, true); } -TEST_CASE("LRM numerical EOC Benchmark with parameter sensitivities for linear case", "[releaseCI],[EOC],[EOC_LRM_FV]") +TEST_CASE("LRM numerical EOC Benchmark with parameter sensitivities for linear case", "[LRM],[FV],[EOC],[EOC_LRM_FV]") { const std::string& modelFilePath = std::string("/data/model_LRM_dynLin_1comp_benchmark1.json"); const std::string& refFilePath = std::string("/data/ref_LRM_dynLin_1comp_sensbenchmark1_FV_Z131072.h5"); @@ -92,7 +92,7 @@ TEST_CASE("LRM numerical EOC Benchmark with parameter sensitivities for linear c cadet::test::column::testEOCReferenceBenchmark(modelFilePath, refFilePath, convFilePath, "001", absTol, relTol, 4, disc, true); } -TEST_CASE("LRM numerical EOC Benchmark with parameter sensitivities for SMA LWE case", "[releaseCI],[EOC],[EOC_LRM_FV]") +TEST_CASE("LRM numerical EOC Benchmark with parameter sensitivities for SMA LWE case", "[LRM],[FV],[EOC],[EOC_LRM_FV]") { const std::string& modelFilePath = std::string("/data/model_LRM_reqSMA_4comp_benchmark1.json"); const std::string& refFilePath = std::string("/data/ref_LRM_reqSMA_4comp_sensbenchmark1_FV_Z4096.h5"); diff --git a/test/UnitOperationTests.cpp b/test/UnitOperationTests.cpp index fbce0bc35..bd0cd770a 100644 --- a/test/UnitOperationTests.cpp +++ b/test/UnitOperationTests.cpp @@ -74,6 +74,8 @@ namespace unitoperation cadet::IUnitOperation* const unitAD = createAndConfigureUnit(jpp, *mb); unitAD->useAnalyticJacobian(false); + REQUIRE(unitAD->requiredADdirs() <= cadet::ad::getMaxDirections()); // this explicit check is required in this test but is automatically performed in simulations + cadet::active* adRes = new cadet::active[unitAD->numDofs()]; cadet::active* adY = new cadet::active[unitAD->numDofs()];