From 0b330706222f9efbce6bb953b302b783f8e7b787 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 3 Oct 2023 16:36:00 +0200 Subject: [PATCH 1/4] fix(codecov): merge coverage.out for a single upload by workflow Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- .github/workflows/gnoland.yml | 31 +++++++++++++++++-------------- .github/workflows/gnovm.yml | 33 ++++++++++++++++++--------------- .github/workflows/tm2.yml | 33 ++++++++++++++++++--------------- 3 files changed, 53 insertions(+), 44 deletions(-) diff --git a/.github/workflows/gnoland.yml b/.github/workflows/gnoland.yml index 09896aaee7b..956c899bc08 100644 --- a/.github/workflows/gnoland.yml +++ b/.github/workflows/gnoland.yml @@ -74,22 +74,25 @@ 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 }} docker-integration: strategy: diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 5ac11805fae..94bb46632f1 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -78,20 +78,23 @@ 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 }} + diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index 2c116d80f87..421d0164f28 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -68,20 +68,23 @@ 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 }} + From 3084d7f7213d09ed24724071ca8808895131d0bb Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:10:32 +0200 Subject: [PATCH 2/4] fix: merge all artifacts to have single upload to codecov Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- .github/workflows/codecov-upload.yaml | 41 +++++++++++++++++++++++++++ .github/workflows/gnoland.yml | 10 +++---- .github/workflows/gnovm.yml | 10 +++---- .github/workflows/tm2.yml | 11 ++++--- 4 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/codecov-upload.yaml diff --git a/.github/workflows/codecov-upload.yaml b/.github/workflows/codecov-upload.yaml new file mode 100644 index 00000000000..deddf3c5eac --- /dev/null +++ b/.github/workflows/codecov-upload.yaml @@ -0,0 +1,41 @@ +name: Codecov Upload + +on: + workflow_run: + workflows: ["gno.land", "tm2", "gnovm"] + types: + - completed + +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - run: mkdir -p ${{ runner.temp }}/coverage + + - name: Download coverage artifact from gnoland + uses: actions/download-artifact@v3 + with: + name: coverage-gnoland + path: ${{ runner.temp }}/coverage/gnoland + + - name: Download coverage artifact from gnovm + uses: actions/download-artifact@v3 + with: + name: coverage-gnovm + path: ${{ runner.temp }}/coverage/gnovm + + - name: Download coverage artifact from tm2 + uses: actions/download-artifact@v3 + with: + name: coverage-tm2 + path: ${{ runner.temp }}/coverage/tm2 + + - 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/gnoland.yml b/.github/workflows/gnoland.yml index 956c899bc08..53a1616706b 100644 --- a/.github/workflows/gnoland.yml +++ b/.github/workflows/gnoland.yml @@ -80,7 +80,7 @@ jobs: name: ${{runner.os}}-coverage-gnoland-${{ matrix.args}}-${{matrix.goversion}} path: ./gno.land/coverage.out - upload-coverage: + upload-coverage-artifact: needs: test runs-on: ubuntu-latest steps: @@ -88,11 +88,11 @@ jobs: uses: actions/download-artifact@v3 with: path: ${{ runner.temp }}/coverage - - name: Upload combined coverage to Codecov - uses: codecov/codecov-action@v3 + - name: Merge and re-upload to a single artifact + uses: actions/upload-artifact@v3 with: - directory: ${{ runner.temp }}/coverage - # token: ${{ secrets.CODECOV_TOKEN }} + name: coverage-gnloand + path: ${{ runner.temp }}/coverage docker-integration: strategy: diff --git a/.github/workflows/gnovm.yml b/.github/workflows/gnovm.yml index 94bb46632f1..cdf3af4e719 100644 --- a/.github/workflows/gnovm.yml +++ b/.github/workflows/gnovm.yml @@ -84,7 +84,7 @@ jobs: name: ${{runner.os}}-coverage-gnovm-${{ matrix.args}}-${{matrix.goversion}} path: ./gnovm/coverage.out - upload-coverage: + upload-coverage-artifact: needs: test runs-on: ubuntu-latest steps: @@ -92,9 +92,9 @@ jobs: uses: actions/download-artifact@v3 with: path: ${{ runner.temp }}/coverage - - name: Upload combined coverage to Codecov - uses: codecov/codecov-action@v3 + - name: Merge and re-upload to a single artifact + uses: actions/upload-artifact@v3 with: - directory: ${{ runner.temp }}/coverage - # token: ${{ secrets.CODECOV_TOKEN }} + name: coverage-gnovm + path: ${{ runner.temp }}/coverage diff --git a/.github/workflows/tm2.yml b/.github/workflows/tm2.yml index 421d0164f28..b6d80ab652c 100644 --- a/.github/workflows/tm2.yml +++ b/.github/workflows/tm2.yml @@ -74,7 +74,7 @@ jobs: name: ${{runner.os}}-coverage-tm2-${{ matrix.args}}-${{matrix.goversion}} path: ./tm2/coverage.out - upload-coverage: + upload-coverage-artifact: needs: test runs-on: ubuntu-latest steps: @@ -82,9 +82,8 @@ jobs: uses: actions/download-artifact@v3 with: path: ${{ runner.temp }}/coverage - - name: Upload combined coverage to Codecov - uses: codecov/codecov-action@v3 + - name: Merge and re-upload to a single artifact + uses: actions/upload-artifact@v3 with: - directory: ${{ runner.temp }}/coverage - # token: ${{ secrets.CODECOV_TOKEN }} - + name: coverage-tm2 + path: ${{ runner.temp }}/coverage From cb2ee4a024be5a3fd672f7b44adce1f64038b5ba Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 3 Oct 2023 17:30:03 +0200 Subject: [PATCH 3/4] fix: name Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- .github/workflows/codecov-upload.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codecov-upload.yaml b/.github/workflows/codecov-upload.yaml index deddf3c5eac..e4192e83d79 100644 --- a/.github/workflows/codecov-upload.yaml +++ b/.github/workflows/codecov-upload.yaml @@ -1,4 +1,4 @@ -name: Codecov Upload +name: codecov-upload on: workflow_run: From 139b3bcc1b9bc883dc1acd9f082e2baa09a30131 Mon Sep 17 00:00:00 2001 From: gfanton <8671905+gfanton@users.noreply.github.com> Date: Tue, 3 Oct 2023 18:45:16 +0200 Subject: [PATCH 4/4] feat: use dawidd6 action download Signed-off-by: gfanton <8671905+gfanton@users.noreply.github.com> --- .github/workflows/codecov-upload.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codecov-upload.yaml b/.github/workflows/codecov-upload.yaml index e4192e83d79..ecd94277979 100644 --- a/.github/workflows/codecov-upload.yaml +++ b/.github/workflows/codecov-upload.yaml @@ -16,22 +16,28 @@ jobs: - run: mkdir -p ${{ runner.temp }}/coverage - name: Download coverage artifact from gnoland - uses: actions/download-artifact@v3 + uses: dawidd6/action-download-artifact@v2 with: + workflow: gnoland.yml name: coverage-gnoland path: ${{ runner.temp }}/coverage/gnoland + if_no_artifact_found: ignore - name: Download coverage artifact from gnovm - uses: actions/download-artifact@v3 + uses: dawidd6/action-download-artifact@v2 with: + workflow: gnovm.yml name: coverage-gnovm path: ${{ runner.temp }}/coverage/gnovm + if_no_artifact_found: ignore - name: Download coverage artifact from tm2 - uses: actions/download-artifact@v3 + uses: dawidd6/action-download-artifact@v2 with: + workflow: tm2.yml name: coverage-tm2 path: ${{ runner.temp }}/coverage/tm2 + if_no_artifact_found: ignore - name: Upload combined coverage to Codecov uses: codecov/codecov-action@v3