diff --git a/.github/workflows/juno-test.yml b/.github/workflows/juno-test.yml index f1dbad0cfd..5acf5ab0d3 100644 --- a/.github/workflows/juno-test.yml +++ b/.github/workflows/juno-test.yml @@ -50,11 +50,10 @@ jobs: - name: Benchmark run: make benchmarks - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4.2.0 + - uses: actions/upload-artifact@v4 if: matrix.os == 'ubuntu-latest' with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true - files: ./coverage/coverage.out - verbose: true \ No newline at end of file + name: code_coverage + path: ./coverage/coverage.out + if-no-files-found: error + retention-days: 1 diff --git a/.github/workflows/upload-codecov.yml b/.github/workflows/upload-codecov.yml new file mode 100644 index 0000000000..353ba2871b --- /dev/null +++ b/.github/workflows/upload-codecov.yml @@ -0,0 +1,43 @@ +name: Upload Codecov + + +on: + workflow_run: + workflows: ["Juno Test"] + types: + - completed + +jobs: + upload: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' + steps: + - name: Download artifact + uses: dawidd6/action-download-artifact@v6 + with: + workflow: ${{ github.event.workflow_run.name }} + run_id: ${{ github.event.workflow_run.id }} + name: code_coverage + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4.2.0 + if: matrix.os == 'ubuntu-latest' + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + files: coverage.out + verbose: true + + - name: 'Comment on PR' + if: github.event.workflow_run.event == 'pull_request' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + await github.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: ${{ github.event.workflow_run.pull_request.number }}, + body: 'Coverage report uploaded to Codecov. Results will be posted soon.' + });