From 5eb06a1dc25670d675e1d5e6555638e4111c3bcc Mon Sep 17 00:00:00 2001 From: Victor Lin Date: Tue, 29 Jul 2025 14:43:47 -0700 Subject: [PATCH] Configure Codecov MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update CI to run pytest with coverage, generate a coverage report, and upload it to Codecov. Using default file paths for coverage results. codecov.yml file copied from Augur.¹ ¹ --- .github/workflows/ci.yaml | 13 +++++++++++-- .gitignore | 5 ++++- codecov.yml | 13 +++++++++++++ pyproject.toml | 4 ++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 codecov.yml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 136a277..92d4c90 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -71,5 +71,14 @@ jobs: # Install project. - run: poetry install --no-interaction - # Run tests. - - run: poetry run pytest + # Run tests with coverage. + - run: poetry run coverage run -m pytest + + # Generate coverage report. + - run: poetry run coverage xml + + # Upload coverage report to Codecov. + - uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false diff --git a/.gitignore b/.gitignore index 0632f33..0a6f604 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ __pycache__/ *.DS_Store -notebooks/.ipynb_checkpointsdocs/_build/html \ No newline at end of file +notebooks/.ipynb_checkpointsdocs/_build/html + +.coverage +coverage.xml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000..c0a1e90 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,13 @@ +comment: + # Only post a codecov comment if coverage changes. + require_changes: true + +coverage: + status: + # Disable GitHub checks for code coverage that make otherwise valid builds fail. + project: off + patch: off + +github_checks: + # Disable inline annotations of code coverage in pull requests. + annotations: false diff --git a/pyproject.toml b/pyproject.toml index c26aff9..8180cbb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ nbsphinx = "^0.9.4" pandoc = "^2.3" isort = "^5.13.2" pre-commit = "^3.7.1" +coverage = "^7" [docs] jupyter = "^1.0.0" @@ -41,6 +42,9 @@ sphinx-rtd-theme = "^2.0.0" nbsphinx = "^0.9.4" pandoc = "^2.3" +[tool.coverage.run] +source = ["evofr"] + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api"