From a8544c153d8030ed7f3a1198e428d706301ca048 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Date: Tue, 7 Oct 2025 09:53:11 +0200 Subject: [PATCH 1/3] Added code_coverage support. --- .github/workflows/fpm-deployment.yml | 61 ++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/.github/workflows/fpm-deployment.yml b/.github/workflows/fpm-deployment.yml index ffcd392e1..226f7cae6 100644 --- a/.github/workflows/fpm-deployment.yml +++ b/.github/workflows/fpm-deployment.yml @@ -3,7 +3,8 @@ name: fpm-deployment on: [push, pull_request] jobs: - test: + deploy: + name: Run tests and deploys the fpm branches runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -41,11 +42,11 @@ jobs: - run: | # Just for deployment: create stdlib-fpm-ilp64 folder python config/fypp_deployment.py --deploy_stdlib_fpm --with_ilp64 - - run: | # Use fpm gnu ci to check xdp and qp + - run: | # Use fpm gnu ci to check xdp and qp python config/fypp_deployment.py --with_xdp --with_qp fpm test --profile release --flag '-DWITH_XDP -DWITH_QP' - # Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch. + # Update and deploy the f90 files generated by github-ci to the `stdlib-fpm` branch. - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@4.1.5 if: github.event_name != 'pull_request' @@ -53,10 +54,62 @@ jobs: BRANCH: stdlib-fpm FOLDER: stdlib-fpm - # Update and deploy the f90 files generated by github-ci to the `stdlib-fpm-ilp64` branch. + # Update and deploy the f90 files generated by github-ci to the `stdlib-fpm-ilp64` branch. - name: Deploy with 64-bit integer support 🚀 uses: JamesIves/github-pages-deploy-action@4.1.5 if: github.event_name != 'pull_request' with: BRANCH: stdlib-fpm-ilp64 FOLDER: stdlib-fpm-ilp64 + + coverage: + name: Generate and upload code coverage report + needs: deploy + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + toolchain: {compiler: gcc, version: 13} + + steps: + - name: Checkout code + uses: actions/checkout@v4.2.2 + with: + ref: stdlib-fpm + + - uses: fortran-lang/setup-fortran@main + id: setup-fortran + with: + compiler: ${{ matrix.toolchain.compiler }} + version: ${{ matrix.toolchain.version }} + + - name: Setup Fortran Package Manager + uses: fortran-lang/setup-fpm@v5 + with: + fpm-version: 'v0.10.0' + + - name: Prepare for code coverage + if: contains( matrix.os, 'ubuntu') + run: | + sudo apt-get install lcov + + - name: Run tests to generate the coverage. + run: fpm test --profile release --flag '-DWITH_XDP -DWITH_QP -coverage' + + - name: Create coverage report + run: | + mkdir -p ${{ env.COV_DIR }} + mv ./build/gfortran_*/*/* ${{ env.COV_DIR }} + lcov --capture --initial --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.base --ignore-errors mismatch + lcov --capture --base-directory . --directory ${{ env.COV_DIR }} --output-file ${{ env.COV_DIR }}/coverage.capture --ignore-errors mismatch + lcov --add-tracefile ${{ env.COV_DIR }}/coverage.base --add-tracefile ${{ env.COV_DIR }}/coverage.capture --output-file ${{ env.COV_DIR }}/coverage.info --ignore-errors mismatch + env: + COV_DIR: build/coverage + + - name: Upload coverage report + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: build/coverage/coverage.info From 91f136a1295cce8b71a021917e237556f0b46910 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Date: Tue, 7 Oct 2025 13:42:53 +0200 Subject: [PATCH 2/3] Update .github/workflows/fpm-deployment.yml Co-authored-by: Federico Perini --- .github/workflows/fpm-deployment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fpm-deployment.yml b/.github/workflows/fpm-deployment.yml index 226f7cae6..52a81e56c 100644 --- a/.github/workflows/fpm-deployment.yml +++ b/.github/workflows/fpm-deployment.yml @@ -88,7 +88,7 @@ jobs: - name: Setup Fortran Package Manager uses: fortran-lang/setup-fpm@v5 with: - fpm-version: 'v0.10.0' + fpm-version: 'v0.12.0' - name: Prepare for code coverage if: contains( matrix.os, 'ubuntu') From 687e733a9c5bdcd75148f6df909334fbfa8f5ba0 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Date: Wed, 8 Oct 2025 14:36:18 +0200 Subject: [PATCH 3/3] bump-up fpm version and setup-fpm version --- .github/workflows/fpm-deployment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fpm-deployment.yml b/.github/workflows/fpm-deployment.yml index 52a81e56c..ef059dbf8 100644 --- a/.github/workflows/fpm-deployment.yml +++ b/.github/workflows/fpm-deployment.yml @@ -32,9 +32,9 @@ jobs: version: ${{ matrix.toolchain.version }} - name: Setup Fortran Package Manager - uses: fortran-lang/setup-fpm@v5 + uses: fortran-lang/setup-fpm@v7 with: - fpm-version: 'v0.10.0' + fpm-version: 'v0.12.0' - run: | # Just for deployment: create stdlib-fpm folder python config/fypp_deployment.py --deploy_stdlib_fpm