From ec3eacc94c504a5a9863144062228f08f30d4488 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Wed, 3 Jul 2024 18:56:47 +0530 Subject: [PATCH 1/4] added codecov --- .github/workflows/test_on_push.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 76d8ec1..3c9c68e 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -6,6 +6,7 @@ on: push: branches: - main + jobs: style: runs-on: ubuntu-latest @@ -52,3 +53,9 @@ jobs: - name: Test Template Generation run: | nox -s test-generation + + - name: Upload coverage report + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' + uses: codecov/codecov-action@v4.5.0 + with: + token: ${{ secrets.CODECOV_TOKEN }} From a4660572c32ba4d90f643f1daf0fd4edd3710fce Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Wed, 3 Jul 2024 18:58:54 +0530 Subject: [PATCH 2/4] added codecov.yml --- .github/codecov.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 0000000..e69de29 From bc545084774b4e253b082cfe390ef0838ac59e38 Mon Sep 17 00:00:00 2001 From: Santhosh Sundaram Date: Fri, 5 Jul 2024 19:16:03 +0530 Subject: [PATCH 3/4] code review suggestions --- .github/codecov.yml | 10 ++++++++++ .github/workflows/test_on_push.yml | 4 ++++ noxfile.py | 8 ++++++++ 3 files changed, 22 insertions(+) diff --git a/.github/codecov.yml b/.github/codecov.yml index e69de29..34d56ca 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -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 diff --git a/.github/workflows/test_on_push.yml b/.github/workflows/test_on_push.yml index 3c9c68e..c68e04d 100644 --- a/.github/workflows/test_on_push.yml +++ b/.github/workflows/test_on_push.yml @@ -54,6 +54,10 @@ jobs: 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/codecov-action@v4.5.0 diff --git a/noxfile.py b/noxfile.py index a42638e..14faeea 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,3 +26,11 @@ def run_template_generation(session): session.install("setuptools", silent=False) 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/") From 201355f403dcbc3e825c0c1d052a5c32121bb868 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 17:56:33 +0000 Subject: [PATCH 4/4] style: pre-commit fixes --- noxfile.py | 1 - 1 file changed, 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 517b14b..228223b 100644 --- a/noxfile.py +++ b/noxfile.py @@ -46,4 +46,3 @@ def set_dev(session): session.run("virtualenv", os.fsdecode(VENV_DIR), silent=True) python = os.fsdecode(VENV_DIR.joinpath("bin/python")) session.run(python, "-m", "pip", "install", "-e", ".[dev]") -