Skip to content

Commit 3036884

Browse files
committed
Add code-coverage for the fpm-deployment github action
1 parent a2fadac commit 3036884

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
@@ -35,15 +35,43 @@ 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-13 gfortran-13
45+
sudo update-alternatives \
46+
--install /usr/bin/gcc gcc /usr/bin/gcc-13 100 \
47+
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-13 \
48+
--slave /usr/bin/gcov gcov /usr/bin/gcov-13
49+
3850
- run: | # Just for deployment: create stdlib-fpm folder
3951
python config/fypp_deployment.py --deploy_stdlib_fpm
4052
4153
- run: | # Just for deployment: create stdlib-fpm-ilp64 folder
4254
python config/fypp_deployment.py --deploy_stdlib_fpm --with_ilp64
4355
44-
- run: | # Use fpm gnu ci to check xdp and qp
56+
- 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 `stdlib-fpm` branch.
4977
- name: Deploy 🚀

0 commit comments

Comments
 (0)