1+ name : Generate Code coverage report and deploy to Codecov
2+
3+ # This file is part of t8code.
4+ # t8code is a C library to manage a collection (a forest) of multiple
5+ # connected adaptive space-trees of general element types in parallel.
6+ #
7+ # Copyright (C) 2025 the developers
8+ #
9+ # t8code is free software; you can redistribute it and/or modify
10+ # it under the terms of the GNU General Public License as published by
11+ # the Free Software Foundation; either version 2 of the License, or
12+ # (at your option) any later version.
13+ #
14+ # t8code is distributed in the hope that it will be useful,
15+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ # GNU General Public License for more details.
18+ #
19+ # You should have received a copy of the GNU General Public License
20+ # along with t8code; if not, write to the Free Software Foundation, Inc.,
21+ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22+
23+ on :
24+ workflow_call :
25+ inputs :
26+ MAKEFLAGS :
27+ required : true
28+ type : string
29+ description : ' Make flags to use for compilation (like -j4)'
30+ MPI :
31+ required : true
32+ type : string
33+ description : ' Use MPI for compilation (ON/OFF)'
34+ BUILD_TYPE :
35+ required : true
36+ type : string
37+ description : ' Build type (Release/Debug)'
38+ TEST_LEVEL :
39+ required : true
40+ type : number
41+ description : ' Test level used for configuring (0 for full tests, 1 for less thorough tests, 2 for minimal tests)'
42+
43+ jobs :
44+ generate-codecov :
45+ timeout-minutes : 30
46+ runs-on : ubuntu-latest
47+ container : dlramr/t8code-ubuntu:t8-dependencies
48+ steps :
49+ #
50+ # Setup
51+ #
52+ - name : Download artifacts
53+ uses : actions/download-artifact@v4
54+ with :
55+ name : SC_P4EST_MPI_${{ inputs.MPI }}
56+ - name : untar artifact
57+ run : tar -xf artifact.tar && rm artifact.tar
58+ - name : Update packages
59+ run : apt-get update && apt-get upgrade -y
60+ # This seems to be necessary because of the docker container.
61+ - name : disable ownership checks
62+ run : git config --global --add safe.directory '*'
63+ - name : Get input vars
64+ run : export MAKEFLAGS="${{ inputs.MAKEFLAGS }}"
65+ && export MPI="${{ inputs.MPI }}"
66+ && export BUILD_TYPE="${{ inputs.BUILD_TYPE }}"
67+ && export SC_PATH=$PWD/sc/build/$BUILD_TYPE
68+ && export P4EST_PATH=$PWD/p4est/build/$BUILD_TYPE
69+ && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV
70+ && echo MPI="$MPI" >> $GITHUB_ENV
71+ && echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV
72+ && echo SC_PATH="$SC_PATH" >> $GITHUB_ENV
73+ && echo P4EST_PATH="$P4EST_PATH" >> $GITHUB_ENV
74+ # # Install lcov.
75+ - name : Install Lcov
76+ run : apt-get install -y lcov
77+ - name : Print lcov version
78+ run : lcov --version
79+
80+ #
81+ # T8CODE
82+ #
83+ # Build config vars
84+ - name : Set test level
85+ if : ${{ inputs.TEST_LEVEL != 0 }}
86+ run : export TEST_LEVEL_FLAG="-DT8CODE_TEST_LEVEL=${{ inputs.TEST_LEVEL }}"
87+ && echo TEST_LEVEL_FLAG="$TEST_LEVEL_FLAG" >> $GITHUB_ENV
88+ - name : build config variables
89+ run : export CONFIG_OPTIONS="${TEST_LEVEL_FLAG} -D8CODE_CODE_COVERAGE=ON -DT8CODE_USE_SYSTEM_SC=ON -DT8CODE_USE_SYSTEM_P4EST=ON -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=ON -DT8CODE_ENABLE_MPI=$MPI -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSC_DIR=$SC_PATH/install/cmake -DP4EST_DIR=$P4EST_PATH/install/cmake"
90+ && echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV
91+ # cmake
92+ - name : echo cmake line
93+ run : echo cmake ../ $CONFIG_OPTIONS
94+ - name : cmake
95+ run : mkdir build && cd build && cmake ../ $CONFIG_OPTIONS
96+ - name : OnFailUploadLog
97+ if : failure()
98+ uses : actions/upload-artifact@v4
99+ with :
100+ name : cmake_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log
101+ path : build/CMakeFiles/CMakeOutput.log
102+ - name : build
103+ run : cd build && cmake --build . $MAKEFLAGS
104+ - name : install
105+ run : cd build && cmake --install .
106+ # Generate Code coverage report.
107+ - name : Generate code coverage report.
108+ run : cd build && cmake --build . --target coverage
109+ - name : Upload coverage to Codecov
110+ uses : codecov/codecov-action@v5
111+ with :
112+ token : ${{ secrets.T8DDY_TOKEN }}
113+ file : ./coverage.info
114+ fail_ci_if_error : true
115+ verbose : true
116+
0 commit comments