Skip to content

Commit

Permalink
Added CodeCov workflow (#19)
Browse files Browse the repository at this point in the history
+ Set up codecov workflow as discussed in today's meet
+ Added a `codecov.yml` config file

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
santacodes and pre-commit-ci[bot] committed Jul 10, 2024
1 parent 6636bcf commit a7aec6d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
codecov:
token: ${{ secrets.CODECOV_TOKEN }}
ci:
- "test_on_push"
strict_yaml_branch: "main"
disable_default_path_fixes: no
require_ci_to_pass: yes

github_checks:
annotations: true
11 changes: 11 additions & 0 deletions .github/workflows/test_on_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
push:
branches:
- main

jobs:
style:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,3 +53,13 @@ jobs:
- name: Test Template Generation
run: |
nox -s test-generation
- name: Run coverage tests
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
run: python -m nox -s coverage

- name: Upload coverage report
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
8 changes: 8 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def run_template_generation(session):
session.install("-e", ".[dev]", silent=False)
session.run("pytest", "tests")

@nox.session(name="coverage")
def run_coverage(session):
"""Run the coverage tests and generate an XML report."""
session.install("setuptools", silent=False)
session.install("coverage", silent=False)
session.install("-e", ".[all,dev,jax]", silent=False)
session.run("pytest", "--cov=src/pybamm_cookiecutter", "--cov-report=xml", "tests/")

@nox.session(name="dev")
def set_dev(session):
"""Install pybamm-cookiecutter in editable mode"""
Expand Down

0 comments on commit a7aec6d

Please sign in to comment.