diff --git a/.github/actions/code_coverage/action.yml b/.github/actions/code_coverage/action.yml index f4cef94f..5776cb74 100644 --- a/.github/actions/code_coverage/action.yml +++ b/.github/actions/code_coverage/action.yml @@ -19,15 +19,3 @@ runs: name: coverage-report.xml path: build/coverage_report.xml retention-days: 30 - - - name: Upload coverage report - uses: wandalen/wretry.action@v1.3.0 - with: - action: codecov/codecov-action@v3 - with: | - files: build/coverage_report.xml - fail_ci_if_error: true - verbose: true - token: ${{ env.CODECOV_TOKEN }} - attempt_limit: 5 - attempt_delay: 10000 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 510b9203..1cfeef88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -123,10 +123,15 @@ jobs: # It will be refactored in https://github.com/XRPLF/clio/issues/1075 - name: Run code coverage if: ${{ matrix.code_coverage }} - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} uses: ./.github/actions/code_coverage + upload_coverage_report: + name: Codecov + needs: build + uses: ./.github/workflows/upload_coverage_report.yml + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + test: name: Run Tests needs: build diff --git a/.github/workflows/upload_coverage_report.yml b/.github/workflows/upload_coverage_report.yml new file mode 100644 index 00000000..c2fc9b82 --- /dev/null +++ b/.github/workflows/upload_coverage_report.yml @@ -0,0 +1,35 @@ +name: Upload report +on: + workflow_dispatch: + workflow_call: + secrets: + CODECOV_TOKEN: + required: true + +jobs: + upload_report: + name: Upload report + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Download report artifact + uses: actions/download-artifact@v3 + with: + name: coverage-report.xml + path: build + + - name: Upload coverage report + if: ${{ hashFiles('build/coverage_report.xml') != '' }} + uses: wandalen/wretry.action@v1.3.0 + with: + action: codecov/codecov-action@v3 + with: | + files: build/coverage_report.xml + fail_ci_if_error: false + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} + attempt_limit: 5 + attempt_delay: 10000