forked from OpenFUSIONToolkit/OpenFUSIONToolkit
-
Notifications
You must be signed in to change notification settings - Fork 3
124 lines (107 loc) · 3.44 KB
/
Copy pathcov_build.yaml
File metadata and controls
124 lines (107 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Coverage Build
on:
push:
branches:
- main
- cov_debug
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: cov-${{ github.ref }}
cancel-in-progress: ${{ contains(github.ref, 'pull/')}}
jobs:
build:
if: (github.event_name != 'pull_request' || github.event.pull_request.draft == false) && github.repository == 'OpenFUSIONToolkit/OpenFUSIONToolkit'
name: Code coverage
runs-on: ubuntu-22.04
env:
CC: gcc-12
CXX: g++-12
FC: gfortran-12
GCOV: gcov-12
OMP_NUM_THREADS: 1
steps:
- name: Checkout repo
uses: actions/checkout@v5
- name: Install prerequisites
run: |
sudo apt-get -y install lcov
python3 -m venv ${{ github.workspace }}/oft_venv
source ${{ github.workspace }}/oft_venv/bin/activate
python -m pip install pytest coverage numpy scipy h5py netcdf4 matplotlib
- name: Cache external libraries
id: cache-ext-libs
uses: actions/cache@v5
with:
path: builds
key: cov_build-${{ hashFiles('src/utilities/build_libs.py') }}
- name: Create build dir
if: ${{ steps.cache-ext-libs.outputs.cache-hit != 'true' }}
run: mkdir builds
- name: Check compilers
run: |
$CC --version
$CXX --version
$FC --version
$GCOV --version
- name: Build external
shell: bash
timeout-minutes: 60
working-directory: builds
run: >
python3 ../src/utilities/build_libs.py --no_dl_progress --nthread=4
--build_mpich=1 --build_arpack=1 --build_petsc=1 --petsc_version=3.23 --petsc_openmp=1
--build_cmake=1 --oft_build_tests=1 --oft_build_coverage
- name: Upload library failure log
uses: actions/upload-artifact@v6
if: failure()
with:
name: Library failure log
path: builds/build/build_error.log
- name: Configure OFT
shell: bash
working-directory: builds
run: |
source ${{ github.workspace }}/oft_venv/bin/activate
bash config_cmake.sh
- name: Build OFT
shell: bash
working-directory: builds/build_release
run: make
- name: Test OFT
shell: bash
timeout-minutes: 120
working-directory: builds/build_release
run: |
source ${{ github.workspace }}/oft_venv/bin/activate
make test
- name: Fixup cache
shell: bash
working-directory: builds
run: |
rm -rf build
rm -rf petsc*
- name: Generate coverage report (GCOV)
shell: bash
working-directory: builds/build_release
run: |
lcov -c --directory . --output-file main_coverage.info --gcov-tool $GCOV
lcov --ignore-errors unused -r main_coverage.info -o cleaned_coverage.txt '/opt/*' '/usr/*'
lcov -l cleaned_coverage.txt
- name: Generate coverage report (Python)
shell: bash
working-directory: builds/build_release/tests
run: |
source ${{ github.workspace }}/oft_venv/bin/activate
coverage combine . grid lin_alg fem physics
coverage report
coverage xml
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v6
with:
files: builds/build_release/cleaned_coverage.txt,builds/build_release/tests/coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}
report_type: coverage
disable_search: true
plugin: noop
verbose: true