Repository navigation
140 lines (122 loc) · 4.81 KB
/
Copy pathci_cov.yml
File metadata and controls
140 lines (122 loc) · 4.81 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Coverage
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
# A new push cancels the running PR build; pushes to main each get their own group
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
coverage:
name: coverage (${{ matrix.leg.name }})
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
leg:
- name: fortran
setup: -Dpython=false
tests: --suite moist
- name: coupling
setup: -Dpython=true -Dpython_version=python3
tests: --suite moist:python
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install compiler
uses: fortran-lang/setup-fortran@1f630c95fa9e0c941248f52e4674260139020365 # v1.11.0
with:
compiler: gcc
version: '15'
- name: Install dependencies (Linux)
run: |
sudo apt-get update
sudo apt-get install -y meson ninja-build liblapack-dev libunwind-dev
- name: Install gcovr
run: |
pipx install --force gcovr==8.6
- uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
if: matrix.leg.name == 'coupling'
with:
python-version: '3.12'
- name: Install Python dependencies
if: matrix.leg.name == 'coupling'
run: python -m pip install --upgrade cffi setuptools pytest numpy pyscf==2.13.1 coverage
- name: Measure the Python package
if: matrix.leg.name == 'coupling'
run: |
cat > "$RUNNER_TEMP/coveragerc" <<EOF
[run]
parallel = true
relative_files = true
source_pkgs = moist
data_file = $GITHUB_WORKSPACE/build/python.coverage
[paths]
moist =
python/moist
*/build/python/moist
EOF
site=$(python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])')
echo "import coverage; coverage.process_startup()" > "$site/moist-coverage.pth"
- name: Set compiler environment
run: |
{
echo "FC=gfortran-15"
echo "CC=gcc-15"
echo "CXX=g++-15"
} >> "$GITHUB_ENV"
- name: Point gcov at the gcc 15 toolchain
run: |
sudo ln -sf "$(command -v gcov-15)" /usr/local/bin/gcov
gcov --version | head -n1
- name: Build with coverage instrumentation
run: |
meson setup build -Db_coverage=true ${{ matrix.leg.setup }} \
"-Dfortran_args=['-fprofile-update=atomic','-fprofile-abs-path']" \
"-Dc_args=['-fprofile-update=atomic','-fprofile-abs-path']" \
"-Dcpp_args=['-fprofile-update=atomic','-fprofile-abs-path']"
meson compile -C build
- name: Run tests
env:
OMP_NUM_THREADS: 1
COVERAGE_PROCESS_START: ${{ matrix.leg.name == 'coupling' && format('{0}/coveragerc', runner.temp) || '' }}
run: |
meson test -C build ${{ matrix.leg.tests }} \
--timeout-multiplier 4 --print-errorlogs
- name: Generate Cobertura XML coverage report
run: |
mkdir -p build/meson-logs
gcovr -r . build \
-e subprojects \
-e 'src/moist/math/fft/(ducc0|finufft|xsimd)/.*' \
-e 'src/moist/math/(linalg/(lsmr|lsqr|lusol)|solver/(fmin|lbfgsb|newton|slsqp))/.*' \
-e '.*data/solvents/geometries\.inc' \
-e '.*_libmoist\.c' \
--include-internal-functions \
--gcov-ignore-errors=no_working_dir_found \
--gcov-suspicious-hits-threshold=1099511627776 \
--print-summary -x -o build/meson-logs/coverage.xml
- name: Generate Python coverage report
if: matrix.leg.name == 'coupling'
run: |
python -m coverage combine --rcfile="$RUNNER_TEMP/coveragerc"
python -m coverage xml --rcfile="$RUNNER_TEMP/coveragerc" \
-o build/meson-logs/python-coverage.xml
- name: Save coverage reports
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: coverage-${{ matrix.leg.name }}
path: build/meson-logs/*coverage.xml
if-no-files-found: error
- name: Upload coverage to Codecov
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: ${{ matrix.leg.name == 'coupling' && 'build/meson-logs/coverage.xml,build/meson-logs/python-coverage.xml' || 'build/meson-logs/coverage.xml' }}
flags: ${{ matrix.leg.name }}
disable_search: true
plugins: noop
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false