diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index 289e605..0000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: report coverage - -on: - workflow_run: - workflows: [test] - types: - - completed - -jobs: - report-coverage: - if: ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - - steps: - - name: download coverage artifact - uses: actions/github-script@v6 - with: - script: | - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "coverage" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/coverage.zip`, Buffer.from(download.data)); - - - name: unzip artifact - run: unzip coverage.zip - - - name: run codacy-coverage-reporter - uses: codacy/codacy-coverage-reporter-action@v1 - with: - project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - coverage-reports: coverage.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2a05218..30c6cd3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,9 +45,9 @@ jobs: run: | pytest tests --cov=sparselm --cov-report=xml - - if: matrix.python_version == '3.11' - name: upload coverage report - uses: actions/upload-artifact@v3 + - if: ${{ matrix.python_version == 3.11 && github.event_name == 'push' }} + name: codacy-coverage-reporter + uses: codacy/codacy-coverage-reporter-action@v1 with: - name: coverage - path: coverage.xml + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + coverage-reports: coverage.xml