Skip to content

Commit e58058a

Browse files
authored
Merge pull request #2 from loiseaujc/code_coverage
Add code coverage
2 parents c7ed3b7 + e8bd39b commit e58058a

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/fpm-deployment.yml

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
matrix:
1111
include:
1212
- os: ubuntu-latest
13-
toolchain: {compiler: gcc, version: 13}
13+
toolchain: {compiler: gcc, version: 14}
1414

1515
steps:
1616
- name: Checkout code
@@ -35,6 +35,18 @@ jobs:
3535
with:
3636
fpm-version: 'v0.10.0'
3737

38+
- name: Prepare for code coverage
39+
if: contains( matrix.os, 'ubuntu')
40+
run: |
41+
sudo apt-get install lcov
42+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
43+
sudo apt-get update
44+
sudo apt-get install -y gcc-14 gfortran-14
45+
sudo update-alternatives \
46+
--install /usr/bin/gcc gcc /usr/bin/gcc-14 100 \
47+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-14 \
48+
--slave /usr/bin/gcov gcov /usr/bin/gcov-14
49+
3850
- run: | # Just for deployment: create fftpack-fpm folder
3951
python config/fypp_deployment.py --deploy_fftpack_fpm
4052
@@ -43,7 +55,23 @@ jobs:
4355
4456
- run: | # Use fpm gnu ci to check xdp and qp
4557
python config/fypp_deployment.py --with_xdp --with_qp
46-
fpm test --profile release --flag '-DWITH_XDP -DWITH_QP'
58+
fpm test --profile release --flag '-DWITH_XDP -DWITH_QP -coverage'
59+
60+
- name: Create coverage report
61+
run: |
62+
mkdir -p ${{ env.COV_DIR }}
63+
mv ./build/gfortran_*/*/* ${{ env.COV_DIR }}
64+
lcov --capture --initial --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.base
65+
lcov --capture --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.capture
66+
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
67+
env:
68+
COV_DIR: build/coverage
69+
70+
- name: Upload coverage report
71+
uses: codecov/codecov-action@v4
72+
with:
73+
token: ${{ secrets.CODECOV_TOKEN }}
74+
files: build/coverage/coverage.info
4775

4876
# Update and deploy the f90 files generated by github-ci to the `fftpack-fpm` branch.
4977
- name: Deploy 🚀

0 commit comments

Comments
 (0)