From d679a58ec6d12048112e0ba8484a4fd32fe38a66 Mon Sep 17 00:00:00 2001 From: M-Chan Date: Fri, 9 Feb 2024 10:18:35 +0000 Subject: [PATCH] deploy: DiamondLightSource/python-copier-template@ffbaa71a17d8a388109be3ac1b0fa6dd88ebe5cb --- .copier-answers.yml | 2 +- .github/workflows/_test.yml | 7 ++++++- .github/workflows/ci.yml | 2 ++ docs/developer/how-to/coverage.md | 8 ++++++++ 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 docs/developer/how-to/coverage.md diff --git a/.copier-answers.yml b/.copier-answers.yml index 5263264..21b5554 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 1.0.2-35-g0dcd88b +_commit: 1.0.2-42-gffbaa71 _src_path: gh:DiamondLightSource/python-copier-template author_email: tom.cobb@diamond.ac.uk author_name: Tom Cobb diff --git a/.github/workflows/_test.yml b/.github/workflows/_test.yml index 9f164af..a5695ac 100644 --- a/.github/workflows/_test.yml +++ b/.github/workflows/_test.yml @@ -9,6 +9,9 @@ on: type: string description: The runner to run this job on required: true + secrets: + CODECOV_TOKEN: + required: true env: # https://github.com/pytest-dev/pytest/issues/2042 @@ -40,7 +43,9 @@ jobs: run: tox -e pytest - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: name: ${{ inputs.python-version }}/${{ inputs.runs-on }} files: cov.xml + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 429936b..c5610dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,8 @@ jobs: with: runs-on: ${{ matrix.runs-on }} python-version: ${{ matrix.python-version }} + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} container: needs: check diff --git a/docs/developer/how-to/coverage.md b/docs/developer/how-to/coverage.md new file mode 100644 index 0000000..660090a --- /dev/null +++ b/docs/developer/how-to/coverage.md @@ -0,0 +1,8 @@ + +# How to check code coverage + +Code coverage is reported to the command line and to a `cov.xml` file by the command `tox -e pytest`. The file is uploaded to the Codecov service in CI. + +## Adding a Codecov Token + +If the repo is not hosted in DiamondLightSource, then you need to visit `https://app.codecov.io/account/gh//org-upload-token` to generate a token for your org, and store it as a secret named `CODECOV_TOKEN` in `https://github.com/organizations//settings/secrets/actions`