From 37658eef7184b5077995fff9fe0854f9899bf039 Mon Sep 17 00:00:00 2001 From: Pavel Komarov Date: Fri, 18 Oct 2024 10:15:19 -0700 Subject: [PATCH] trying to fix coverage (#735) * trying to fix coverage * put the coveralls call in a different job so it happens whether or not there's a failure in the tests * invalid yaml. trying again * trying to add always() so we upload to coveralls even when a test fails https://stackoverflow.com/questions/58858429/how-to-run-a-github-actions-step-even-if-the-previous-step-fails-while-still-f * added github_token, because that's what the error message said to do, but not sure why I have to https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication * added line to see whether .coverage file is being generated * added a cd down to the directory where the coverage report lives --- .github/workflows/testing.yml | 14 ++++++++++++-- README.md | 3 +-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 03b8e032..5f6dfe7e 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -31,7 +31,7 @@ jobs: pip install 'numpy<2.0' pip install matplotlib #Some imports require matplotlib pip install scipy #To not skip tests - pip install flake8 meson-python ninja pytest + pip install flake8 meson-python ninja pytest coveralls # if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Checkout Clawpack @@ -53,4 +53,14 @@ jobs: - name: Test with pytest run: | cd ${CLAW}/pyclaw - pytest --ignore=development -k "not test_shallow_sphere" + coverage run --source=src -m pytest --ignore=development -k "not test_shallow_sphere" + + - name: Upload to Coveralls + if: always() + run: | + cd ${CLAW}/pyclaw + ls -l .coverage + coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 32813780..03ead5d1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ [![Build Status](https://github.com/clawpack/pyclaw/actions/workflows/testing.yml/badge.svg)](https://github.com/clawpack/pyclaw/actions) -[![Coverage Status](https://img.shields.io/coveralls/clawpack/pyclaw.svg)](https://coveralls.io/r/clawpack/pyclaw?branch=master) - +[![Coverage Status](https://coveralls.io/repos/github/clawpack/pyclaw/badge.svg?branch=master)](https://coveralls.io/r/clawpack/pyclaw?branch=master) [![PyPI version](https://badge.fury.io/py/clawpack.svg)](https://badge.fury.io/py/clawpack)