From 4b9a50997aecb4256a3fe1d7e5023439070a8ff5 Mon Sep 17 00:00:00 2001 From: Martin Yeo Date: Wed, 2 Oct 2024 14:57:05 +0100 Subject: [PATCH 1/3] Use the Codecov GitHub Action. --- .github/workflows/ci-tests.yml | 7 ++++--- tox.ini | 3 --- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index f8ac9424..7c912973 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -40,7 +40,6 @@ jobs: - os: ubuntu-latest version: py312 posargs: "--cov-report=xml --cov" - post-command: codecov - os: macos-latest version: py312 platform: osx @@ -109,10 +108,12 @@ jobs: key: ${{ runner.os }}-tox-${{ env.ENV_NAME }}-${{ matrix.version }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.TOX_INI) }} - name: "Run ${{ matrix.os }} on ${{ matrix.version}} tests" - env: - POST_COMMAND: ${{ matrix.post-command }} run: | export PATH=${{ matrix.gitpath-prepend }}$PATH which git git --version tox -e ${{ matrix.version }}-${{ matrix.platform }}-test -- ${{ matrix.posargs }} + + - name: "Upload coverage report to Codecov" + if: contains(matrix.posargs, "--cov") + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 \ No newline at end of file diff --git a/tox.ini b/tox.ini index 8a94fba7..9d7e6cd6 100644 --- a/tox.ini +++ b/tox.ini @@ -46,11 +46,8 @@ conda_spec = description = Perform cf-units unit/integration tests. passenv = - CODECOV_TOKEN CYTHON_COVERAGE - POST_COMMAND usedevelop = true commands = pytest {posargs} - {env:POST_COMMAND:} From d9dce0fa6cc6f97222db4bc9fd33e2c33673c751 Mon Sep 17 00:00:00 2001 From: Martin Yeo Date: Wed, 2 Oct 2024 15:07:28 +0100 Subject: [PATCH 2/3] Try single quotes. --- .github/workflows/ci-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 7c912973..1f56141e 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -115,5 +115,5 @@ jobs: tox -e ${{ matrix.version }}-${{ matrix.platform }}-test -- ${{ matrix.posargs }} - name: "Upload coverage report to Codecov" - if: contains(matrix.posargs, "--cov") + if: contains(matrix.posargs, '--cov') uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 \ No newline at end of file From 21ce9324ea43e33bc4d3c1ad576906ae4770e8a8 Mon Sep 17 00:00:00 2001 From: Martin Yeo Date: Wed, 2 Oct 2024 15:12:23 +0100 Subject: [PATCH 3/3] Limit scope of Codecov token. --- .github/workflows/ci-tests.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 1f56141e..df7d54e2 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -26,7 +26,6 @@ jobs: run: shell: bash -l {0} env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} CYTHON_COVERAGE: 1 ENV_NAME: "ci-tests" strategy: @@ -116,4 +115,6 @@ jobs: - name: "Upload coverage report to Codecov" if: contains(matrix.posargs, '--cov') - uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 \ No newline at end of file + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 + with: + token: ${{ secrets.CODECOV_TOKEN }}