From c315db647cc4b236fc4485aa6c4fb69b7240c31f Mon Sep 17 00:00:00 2001 From: Guilhem Fanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 3 Oct 2023 19:07:29 +0200 Subject: [PATCH] fix(codecov): merge coverage for a single upload by workflow (#1190) It appears that the retry system introduced in #1186 was not sufficient, as we still hit API limits when running multiple checks concurrently. This PR merges all coverage files into a single upload at the of each testing workflows. As a result, we now have 3 uploads instead of 16, which should drastically reduce the number of Codecov upload failures. Note: It still appears to fail randomly, but we might need to wait some time until our API rate decreases. I believe it's still preferable to have 3 uploads rather than 16, which seemed to overwhelm Codecov. --------- Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- .github/workflows/gnoland.yml | 32 ++++++++++++++++++-------------- .github/workflows/gnovm.yml | 34 +++++++++++++++++++--------------- .github/workflows/tm2.yml | 34 +++++++++++++++++++--------------- 3 files changed, 56 insertions(+), 44 deletions(-) diff --git a/.github/workflows/gnoland.yml b/.github/workflows/gnoland.yml index 09896aaee7b..e2b099c2b92 100644 --- a/.github/workflows/gnoland.yml +++ b/.github/workflows/gnoland.yml @@ -74,22 +74,26 @@ jobs: export GOPATH=$HOME/go export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic" make ${{ matrix.args }} + - uses: actions/upload-artifact@v3 + if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} + with: + name: ${{runner.os}}-coverage-gnoland-${{ matrix.args}}-${{matrix.goversion}} + path: ./gno.land/coverage.out - # NOTE: Using retry action to manage occasional upload failures to codecov.io, due to API limits. - # Refer to issue#3954: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 - - if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} - name: Upload coverage to Codecov.io - uses: Wandalen/wretry.action@v1.3.0 + upload-coverage: + needs: test + runs-on: ubuntu-latest + steps: + - name: Download all previous coverage artifacts + uses: actions/download-artifact@v3 + with: + path: ${{ runner.temp }}/coverage + - name: Upload combined coverage to Codecov + uses: codecov/codecov-action@v3 with: - attempt_limit: 3 - attempt_delay: 30000 - action: codecov/codecov-action@v3 - with: | - token: ${{ secrets.CODECOV_TOKEN }} - name: gno.land - flags: gno.land-${{matrix.args}} - files: ./gno.land/coverage.out - fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} + directory: ${{ runner.temp }}/coverage + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} docker-integration: strategy: diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 5ac11805fae..71b03b5ca05 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -78,20 +78,24 @@ jobs: export GOPATH=$HOME/go export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic" make ${{ matrix.args }} + - uses: actions/upload-artifact@v3 + if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} + with: + name: ${{runner.os}}-coverage-gnovm-${{ matrix.args}}-${{matrix.goversion}} + path: ./gnovm/coverage.out - # NOTE: Using retry action to manage occasional upload failures to codecov.io, due to API limits. - # Refer to issue#3954: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 - - if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} - name: Upload coverage to Codecov.io - uses: Wandalen/wretry.action@v1.3.0 + upload-coverage: + needs: test + runs-on: ubuntu-latest + steps: + - name: Download all previous coverage artifacts + uses: actions/download-artifact@v3 with: - attempt_limit: 3 - attempt_delay: 30000 - action: codecov/codecov-action@v3 - with: | - token: ${{ secrets.CODECOV_TOKEN }} - name: gnovm - verbose: true - flags: gnovm-${{matrix.args}} - files: ./gnovm/coverage.out - fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} + path: ${{ runner.temp }}/coverage + - name: Upload combined coverage to Codecov + uses: codecov/codecov-action@v3 + with: + directory: ${{ runner.temp }}/coverage + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} + diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index 2c116d80f87..7b78ccb1e0f 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -68,20 +68,24 @@ jobs: export GOTEST_FLAGS="-v -p 1 -timeout=30m -coverprofile=coverage.out -covermode=atomic" make ${{ matrix.args }} touch coverage.out + - uses: actions/upload-artifact@v3 + if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} + with: + name: ${{runner.os}}-coverage-tm2-${{ matrix.args}}-${{matrix.goversion}} + path: ./tm2/coverage.out - # NOTE: Using retry action to manage occasional upload failures to codecov.io, due to API limits. - # Refer to issue#3954: https://community.codecov.com/t/upload-issues-unable-to-locate-build-via-github-actions-api/3954 - - if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }} - name: Upload coverage to Codecov.io - uses: Wandalen/wretry.action@v1.3.0 + upload-coverage: + needs: test + runs-on: ubuntu-latest + steps: + - name: Download all previous coverage artifacts + uses: actions/download-artifact@v3 with: - attempt_limit: 3 - attempt_delay: 30000 - action: codecov/codecov-action@v3 - with: | - token: ${{ secrets.CODECOV_TOKEN }} - name: tm2 - verbose: true - flags: tm2-${{matrix.args}} - files: ./tm2/coverage.out - fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} + path: ${{ runner.temp }}/coverage + - name: Upload combined coverage to Codecov + uses: codecov/codecov-action@v3 + with: + directory: ${{ runner.temp }}/coverage + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }} +