Skip to content

Commit 812446f

Browse files
committed
Deploy code coverage in a separate GA.
1 parent d933b31 commit 812446f

File tree

2 files changed

+69
-32
lines changed

2 files changed

+69
-32
lines changed

.github/workflows/codecov.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: fpm-deployment
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
include:
12+
- os: ubuntu-latest
13+
toolchain: {compiler: gcc, version: 14}
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/[email protected]
18+
19+
- name: Set up Python 3.x
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: 3.x
23+
24+
- name: Install requirements
25+
run: pip install --upgrade -r config/requirements.txt
26+
27+
- uses: fortran-lang/setup-fortran@main
28+
id: setup-fortran
29+
with:
30+
compiler: ${{ matrix.toolchain.compiler }}
31+
version: ${{ matrix.toolchain.version }}
32+
33+
- name: Setup Fortran Package Manager
34+
uses: fortran-lang/setup-fpm@v5
35+
with:
36+
fpm-version: 'v0.10.0'
37+
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+
50+
- name: Run test to generate the coverage.
51+
run: | # Use fpm gnu ci to check xdp and qp
52+
python config/fypp_deployment.py #--with_xdp --with_qp
53+
fpm test --profile debug --flag '-coverage'
54+
55+
- name: Create coverage report
56+
run: |
57+
mkdir -p ${{ env.COV_DIR }}
58+
mv ./build/gfortran_*/*/* ${{ env.COV_DIR }}
59+
lcov --capture --initial --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.base
60+
lcov --capture --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.capture
61+
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
62+
env:
63+
COV_DIR: build/coverage
64+
65+
- name: Upload coverage report
66+
uses: codecov/codecov-action@v4
67+
with:
68+
token: ${{ secrets.CODECOV_TOKEN }}
69+
files: build/coverage/coverage.info

.github/workflows/fpm-deployment.yml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ 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-
5038
- run: | # Just for deployment: create stdlib-fpm folder
5139
python config/fypp_deployment.py --deploy_stdlib_fpm
5240
@@ -57,26 +45,6 @@ jobs:
5745
python config/fypp_deployment.py --with_xdp --with_qp
5846
fpm test --profile release --flag '-DWITH_XDP -DWITH_QP'
5947
60-
- run: | # Use fpm gnu ci to check xdp and qp
61-
python config/fypp_deployment.py --with_xdp --with_qp
62-
fpm test --profile debug --flag '-DWITH_XDP -DWITH_QP -coverage'
63-
64-
- name: Create coverage report
65-
run: |
66-
mkdir -p ${{ env.COV_DIR }}
67-
mv ./build/gfortran_*/*/* ${{ env.COV_DIR }}
68-
lcov --capture --initial --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.base
69-
lcov --capture --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.capture
70-
lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info
71-
env:
72-
COV_DIR: build/coverage
73-
74-
- name: Upload coverage report
75-
uses: codecov/codecov-action@v4
76-
with:
77-
token: ${{ secrets.CODECOV_TOKEN }}
78-
files: build/coverage/coverage.info
79-
8048
# Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch.
8149
- name: Deploy 🚀
8250
uses: JamesIves/[email protected]

0 commit comments

Comments
 (0)