From 2c05b68057ba6bba4ecd93afa92cca4b5513e64b Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 00:04:23 +0100 Subject: [PATCH 01/13] setup codecov for C++ and Fortran files in PyPartMC src folder --- .github/workflows/codecov.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 00000000..78fa4374 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,25 @@ +name: codecov + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + codecov: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + submodules: recursive + fetch-depth: 0 + - run: sudo apt install -y lcov + - run: | + CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] + lcov --capture --include="src/*" --initial --directory . --output-file coverage1.info + pytest -We tests + lcov --capture --include="src/*" --directory . --output-file coverage2.info + lcov --add-tracefile ./coverage1.info --add-tracefile ./coverage2.info --output-file coveragefused.info + lcov -r coveragefused.info "/usr*" -o coveragefused.info + - uses: codecov/codecov-action@v5.3.1 From e3057204f1a582e322d2bff2d39f47e7680a25b3 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 10:39:00 +0100 Subject: [PATCH 02/13] pin to older Ubuntu to avoid newer-GCC/lcov clash --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 78fa4374..5222302f 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -8,7 +8,7 @@ on: jobs: codecov: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4.2.2 with: From eae74d7a84373066235f151d8b37d52267930b4b Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 12:51:56 +0100 Subject: [PATCH 03/13] simplify codecov workflow --- .github/workflows/codecov.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 5222302f..146dae66 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -16,10 +16,8 @@ jobs: fetch-depth: 0 - run: sudo apt install -y lcov - run: | + set -xe CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] - lcov --capture --include="src/*" --initial --directory . --output-file coverage1.info pytest -We tests - lcov --capture --include="src/*" --directory . --output-file coverage2.info - lcov --add-tracefile ./coverage1.info --add-tracefile ./coverage2.info --output-file coveragefused.info - lcov -r coveragefused.info "/usr*" -o coveragefused.info + lcov --all --capture --directory CMakeFiles/_PyPartMC.dir/src/ --output-file coverage.info - uses: codecov/codecov-action@v5.3.1 From 34982f6819e5a0d19f531bc83f4ee184c22d1289 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 13:00:13 +0100 Subject: [PATCH 04/13] add token, remove --all --- .github/workflows/codecov.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 146dae66..5b070e5a 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -19,5 +19,7 @@ jobs: set -xe CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests - lcov --all --capture --directory CMakeFiles/_PyPartMC.dir/src/ --output-file coverage.info + lcov --capture --directory CMakeFiles/_PyPartMC.dir/src/ --output-file coverage.info - uses: codecov/codecov-action@v5.3.1 + with: + token: ${{ secrets.CODECOV_TOKEN }} From 9984f826e396ba0f2fd4d7aac6a02d6683bb0f8f Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 16:57:40 +0100 Subject: [PATCH 05/13] try without folder spec --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 5b070e5a..a7abb4ec 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -19,7 +19,7 @@ jobs: set -xe CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests - lcov --capture --directory CMakeFiles/_PyPartMC.dir/src/ --output-file coverage.info + lcov --capture --directory . --output-file coverage.info - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }} From 26e7ecda3aff57cc939ee4f3a0173558a285ba75 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 17:18:03 +0100 Subject: [PATCH 06/13] try with src dir spec --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index a7abb4ec..f83efc04 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -19,7 +19,7 @@ jobs: set -xe CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests - lcov --capture --directory . --output-file coverage.info + lcov --capture --directory src --output-file coverage.info --no-external - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }} From d5d64d8adc50cf92d3fd3c1b13fa723a5d62b7be Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 17:31:25 +0100 Subject: [PATCH 07/13] enable debug access --- .github/workflows/codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index f83efc04..5b21b012 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -20,6 +20,10 @@ jobs: CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests lcov --capture --directory src --output-file coverage.info --no-external + - if: ${{ failure() }} + uses: mxschmitt/action-tmate@v3 + with: + limit-access-to-actor: true - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }} From 733f6e05cf40bc14271ede76290a90c2f3715ebc Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 17:34:19 +0100 Subject: [PATCH 08/13] add codecov badge to README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2f911743..a9ce80f6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ If interested in contributing to PyPartMC, please have a look a the [notes for d [![Copyright](https://img.shields.io/static/v1?label=Copyright&color=249fe2&message=UIUC&)](https://atmos.illinois.edu/) [![Github Actions Build Status](https://github.com/open-atmos/PyPartMC/workflows/tests+pypi/badge.svg?branch=main)](https://github.com/open-atmos/PyPartMC/actions) [![API docs](https://shields.mitmproxy.org/badge/docs-pdoc.dev-brightgreen.svg)](https://open-atmos.github.io/PyPartMC/) +[![codecov](https://codecov.io/gh/open-atmos/PyPartMC/graph/badge.svg?token=27IK9ZIQXE)](https://codecov.io/gh/open-atmos/PyPartMC) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7662635.svg)](https://doi.org/10.5281/zenodo.7662635) [![PyPI version](https://badge.fury.io/py/PyPartMC.svg)](https://pypi.org/p/PyPartMC) From 02adaeadb9d7c0c050d27ebe627557cd4b59c33d Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 17:40:06 +0100 Subject: [PATCH 09/13] remove condition for tmate --- .github/workflows/codecov.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 5b21b012..ca74ddbe 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -20,8 +20,7 @@ jobs: CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests lcov --capture --directory src --output-file coverage.info --no-external - - if: ${{ failure() }} - uses: mxschmitt/action-tmate@v3 + - uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: true - uses: codecov/codecov-action@v5.3.1 From 78c19f213c66273a70cc0f6449553eb503335f3e Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 18:02:28 +0100 Subject: [PATCH 10/13] fix path, disable tmate --- .github/workflows/codecov.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index ca74ddbe..574ce70e 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -19,10 +19,10 @@ jobs: set -xe CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests - lcov --capture --directory src --output-file coverage.info --no-external - - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true + lcov --capture --directory ./build/*/_PyPartMC/CMakeFiles/_PyPartMC.dir/ --output-file coverage.info --no-external + # - uses: mxschmitt/action-tmate@v3 + # with: + # limit-access-to-actor: true - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }} From 252e3ec486aa2744842ff28ea2d546d8deecc7c6 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 20:32:08 +0100 Subject: [PATCH 11/13] specify which file to upload --- .github/workflows/codecov.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 574ce70e..46e624a7 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -26,3 +26,6 @@ jobs: - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }} + disable_search: true + fail_ci_if_error: true + files: coverage.info From cfb400783da6c41985a3b321fb1b151ef1d532d3 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 21:18:33 +0100 Subject: [PATCH 12/13] manually delete surplus .gcno files --- .github/workflows/codecov.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 46e624a7..4f49bd62 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -20,12 +20,8 @@ jobs: CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests lcov --capture --directory ./build/*/_PyPartMC/CMakeFiles/_PyPartMC.dir/ --output-file coverage.info --no-external - # - uses: mxschmitt/action-tmate@v3 - # with: - # limit-access-to-actor: true + - run: find build/*/_PyPartMC/gitmodules -name \*.gcno -delete - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }} - disable_search: true fail_ci_if_error: true - files: coverage.info From d4043f10e17942a0fb7ec9700d2ee320ebac80b2 Mon Sep 17 00:00:00 2001 From: Sylwester Arabas Date: Wed, 29 Jan 2025 21:37:13 +0100 Subject: [PATCH 13/13] fix find/delete --- .github/workflows/codecov.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 4f49bd62..3cbc5811 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -20,7 +20,7 @@ jobs: CMAKE_ARGS="-DCMAKE_CXX_FLAGS=--coverage -DCMAKE_C_FLAGS=--coverage -DCMAKE_Fortran_FLAGS=--coverage" pip install -e .[tests] pytest -We tests lcov --capture --directory ./build/*/_PyPartMC/CMakeFiles/_PyPartMC.dir/ --output-file coverage.info --no-external - - run: find build/*/_PyPartMC/gitmodules -name \*.gcno -delete + - run: find -name \*.gcno | grep -v pypartmc.cpp | grep -v _PyPartMC.dir | xargs rm - uses: codecov/codecov-action@v5.3.1 with: token: ${{ secrets.CODECOV_TOKEN }}