From 472bb8890d5e44c662ec8e416e99ca6850abb43c Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 10:47:51 +0200 Subject: [PATCH 1/7] add api testfile --- .github/workflows/tests_cmake_t8code_api.yml | 107 +++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 .github/workflows/tests_cmake_t8code_api.yml diff --git a/.github/workflows/tests_cmake_t8code_api.yml b/.github/workflows/tests_cmake_t8code_api.yml new file mode 100644 index 0000000000..ee3c75047d --- /dev/null +++ b/.github/workflows/tests_cmake_t8code_api.yml @@ -0,0 +1,107 @@ +name: CMake tests t8code api + + +# This file is part of t8code. +# t8code is a C library to manage a collection (a forest) of multiple +# connected adaptive space-trees of general element types in parallel. +# +# Copyright (C) 2024 the developers +# +# t8code is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# t8code is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with t8code; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +on: + workflow_call: + inputs: + MAKEFLAGS: + required: true + type: string + MPI: + required: true + type: string + BUILD_TYPE: + required: true + type: string + LESS_TESTS: + required: true + type: boolean + +jobs: + t8code_cmake_tests: + timeout-minutes: 30 + runs-on: ubuntu-latest + container: dlramr/t8code-ubuntu:t8-dependencies + steps: +# +# Setup +# + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: SC_P4EST_MPI_${{ inputs.MPI }} + - name: untar artifact + run: tar -xf artifact.tar && rm artifact.tar + - name: Update packages + run: apt-get update && apt-get upgrade -y + # This seems to be necessary because of the docker container + - name: disable ownership checks + run: git config --global --add safe.directory '*' + - name: Get input vars + run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" + && export MPI="${{ inputs.MPI }}" + && export BUILD_TYPE="${{ inputs.BUILD_TYPE }}" + && export SC_PATH=$PWD/sc/build/$BUILD_TYPE + && export P4EST_PATH=$PWD/p4est/build/$BUILD_TYPE + && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV + && echo MPI="$MPI" >> $GITHUB_ENV + && echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV + && echo SC_PATH="$SC_PATH" >> $GITHUB_ENV + && echo P4EST_PATH="$P4EST_PATH" >> $GITHUB_ENV +# +# T8CODE +# +# + # build config vars + - name: less-test option + if: ${{ inputs.LESS_TESTS }} + run: export LESS_TEST_OPTION="-DT8CODE_ENABLE_LESS_TESTS=ON" + && echo LESS_TEST_OPTION="$LESS_TEST_OPTION" >> $GITHUB_ENV + - name: build config variables + run: export CONFIG_OPTIONS="${LESS_TEST_OPTION} -GNinja -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake" + && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV + # cmake and test with fortran + - name: check fortran + run: echo "Checking fortran" + - name: echo cmake line + run: echo cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_FORTRAN=ON + - name: cmake MPI fortran debug + run: mkdir build_fortran && cd build_fortran && cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_FORTRAN=ON + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: cmake_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_fortran.log + path: build_fortran/CMakeFiles/CMakeOutput.log + - name: make + run: cd build_fortran && ninja $MAKEFLAGS + - name: ninja install + run: cd build_fortran && ninja install $MAKEFLAGS + - name: ninja test + run: cd build_fortran && ninja test $MAKEFLAGS + - name: OnFailUploadLog + if: failure() + uses: actions/upload-artifact@v4 + with: + name: test-suite_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}_fortran.log + path: build_fortran/Testing/Temporary/LastTest.log From 80d806a6057a78e21516728c178706e5148711a9 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Mon, 12 Aug 2024 10:48:09 +0200 Subject: [PATCH 2/7] add api tests to workflow --- .github/workflows/tests_cmake_testsuite.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/tests_cmake_testsuite.yml b/.github/workflows/tests_cmake_testsuite.yml index ba3616153c..f6c7ca8d9d 100644 --- a/.github/workflows/tests_cmake_testsuite.yml +++ b/.github/workflows/tests_cmake_testsuite.yml @@ -114,3 +114,20 @@ jobs: BUILD_TYPE: ${{ matrix.BUILD_TYPE }} LESS_TESTS: ${{ github.event_name == 'pull_request' }} + # Run t8code linkage tests with and without MPI and in serial and debug mode + t8code_api_tests: + if: (github.event_name == 'schedule' && github.repository == 'DLR-AMR/t8code') || (github.event_name != 'schedule') && false + uses: ./.github/workflows/tests_cmake_t8code_api.yml + strategy: + fail-fast: false + matrix: + MPI: [OFF, ON] + BUILD_TYPE: [Debug, Release] + include: + - MAKEFLAGS: -j4 + needs: preparation + with: + MAKEFLAGS: ${{ matrix.MAKEFLAGS }} + MPI: ${{ matrix.MPI }} + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + LESS_TESTS: ${{ github.event_name == 'pull_request' }} From 3b187f12b1c6a47ba2180d1647961156f20caa8f Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 11:48:20 +0200 Subject: [PATCH 3/7] add input description for cmake ci t8code api tests --- .github/workflows/tests_cmake_t8code_api.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/tests_cmake_t8code_api.yml b/.github/workflows/tests_cmake_t8code_api.yml index ee3c75047d..f38659f2e0 100644 --- a/.github/workflows/tests_cmake_t8code_api.yml +++ b/.github/workflows/tests_cmake_t8code_api.yml @@ -27,15 +27,19 @@ on: MAKEFLAGS: required: true type: string + description: 'Make flags to use for compilation (like -j4)' MPI: required: true type: string + description: 'Use MPI for compilation (ON/OFF)' BUILD_TYPE: required: true type: string + description: 'Build type (Release/Debug)' LESS_TESTS: required: true type: boolean + description: 'Enable less tests option for configuring' jobs: t8code_cmake_tests: From a5799d7d9b337858a3de9562ffff504486edce35 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Tue, 20 Aug 2024 14:01:28 +0200 Subject: [PATCH 4/7] switch from ninja test to ctest for parallel test execution --- .github/workflows/tests_cmake_t8code_api.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_cmake_t8code_api.yml b/.github/workflows/tests_cmake_t8code_api.yml index f38659f2e0..c078984f60 100644 --- a/.github/workflows/tests_cmake_t8code_api.yml +++ b/.github/workflows/tests_cmake_t8code_api.yml @@ -101,8 +101,8 @@ jobs: run: cd build_fortran && ninja $MAKEFLAGS - name: ninja install run: cd build_fortran && ninja install $MAKEFLAGS - - name: ninja test - run: cd build_fortran && ninja test $MAKEFLAGS + - name: ctest + run: cd build_fortran && ctest $MAKEFLAGS - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From 2b7cb44e4103b05eeaef36cbdeff468b8620e237 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 23 Aug 2024 12:18:34 +0200 Subject: [PATCH 5/7] execute tests in serial bc its faster --- .github/workflows/tests_cmake_t8code_api.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_cmake_t8code_api.yml b/.github/workflows/tests_cmake_t8code_api.yml index c078984f60..5c6d42e08c 100644 --- a/.github/workflows/tests_cmake_t8code_api.yml +++ b/.github/workflows/tests_cmake_t8code_api.yml @@ -101,8 +101,8 @@ jobs: run: cd build_fortran && ninja $MAKEFLAGS - name: ninja install run: cd build_fortran && ninja install $MAKEFLAGS - - name: ctest - run: cd build_fortran && ctest $MAKEFLAGS + - name: ninja test + run: cd build_fortran && ninja test - name: OnFailUploadLog if: failure() uses: actions/upload-artifact@v4 From 7c56ce66895dde51190bc5c9e36c33c8c17cf8a1 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 27 Sep 2024 11:24:00 +0200 Subject: [PATCH 6/7] enforce MPI in api tests --- .github/workflows/tests_cmake_testsuite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_cmake_testsuite.yml b/.github/workflows/tests_cmake_testsuite.yml index b66ab540cc..0ab57b62a1 100644 --- a/.github/workflows/tests_cmake_testsuite.yml +++ b/.github/workflows/tests_cmake_testsuite.yml @@ -121,7 +121,7 @@ jobs: strategy: fail-fast: false matrix: - MPI: [OFF, ON] + MPI: [ON] # For now the fortran API only supports building with MPI BUILD_TYPE: [Debug, Release] include: - MAKEFLAGS: -j4 From 91433fa70668d667a8410d89f65da20fd370d6c7 Mon Sep 17 00:00:00 2001 From: Sandro Elsweijer Date: Fri, 27 Sep 2024 11:24:30 +0200 Subject: [PATCH 7/7] update fortran build flag in ci --- .github/workflows/tests_cmake_t8code_api.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_cmake_t8code_api.yml b/.github/workflows/tests_cmake_t8code_api.yml index 5c6d42e08c..d96b5d0b33 100644 --- a/.github/workflows/tests_cmake_t8code_api.yml +++ b/.github/workflows/tests_cmake_t8code_api.yml @@ -88,7 +88,7 @@ jobs: - name: check fortran run: echo "Checking fortran" - name: echo cmake line - run: echo cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_FORTRAN=ON + run: echo cmake ../ $CONFIG_OPTIONS -DT8CODE_BUILD_FORTRAN_INTERFACE=ON - name: cmake MPI fortran debug run: mkdir build_fortran && cd build_fortran && cmake ../ $CONFIG_OPTIONS -DT8CODE_ENABLE_FORTRAN=ON - name: OnFailUploadLog