From 10fe315ba3a214eb569628ba1c0526efb2445fa4 Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Tue, 26 Mar 2024 15:45:19 +0200 Subject: [PATCH 1/4] add test-coverage --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 611894dd9..897e2cea8 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -20,7 +20,7 @@ permissions: jobs: contracts: name: Contracts - uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v2.3.5 + uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@3c37e52a9de8f4111f823da0b2412f1fc55b7d30 with: rust-toolchain: nightly-2023-12-11 vmtools-version: v1.5.24 From 518fff63d98aa7d99e3fa7ff13394eeeca24342e Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Tue, 26 Mar 2024 16:18:46 +0200 Subject: [PATCH 2/4] add test-coverage --- .github/workflows/actions.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 897e2cea8..2a5bfc833 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -23,6 +23,6 @@ jobs: uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@3c37e52a9de8f4111f823da0b2412f1fc55b7d30 with: rust-toolchain: nightly-2023-12-11 - vmtools-version: v1.5.24 + # vmtools-version: v1.5.24 secrets: token: ${{ secrets.GITHUB_TOKEN }} From bc5545e64c3351b2b91b0b79e1ffafeb2af0a57b Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Wed, 27 Mar 2024 11:26:11 +0200 Subject: [PATCH 3/4] add test-coverage --- .github/workflows/actions.yml | 55 +++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 2a5bfc833..dba47b91c 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -20,9 +20,60 @@ permissions: jobs: contracts: name: Contracts - uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@3c37e52a9de8f4111f823da0b2412f1fc55b7d30 + uses: multiversx/mx-sc-actions/.github/workflows/contracts.yml@v2.3.5 with: rust-toolchain: nightly-2023-12-11 - # vmtools-version: v1.5.24 + vmtools-version: v1.5.24 secrets: token: ${{ secrets.GITHUB_TOKEN }} + + test_coverage: + name: Test Coverage + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly-2023-12-11 + target: wasm32-unknown-unknown + + - name: Install prerequisites + run: | + rustup component add llvm-tools-preview + dirname $(find ~/.rustup -name llvm-cov) >> $GITHUB_PATH + + echo $(dirname $(find ~/.rustup -name llvm-cov)) + + cargo install multiversx-sc-meta --locked + + - name: Run tests and generate report + env: + RUSTFLAGS: "" + run: | + sc-meta test-coverage --output ./coverage.md + + - name: Upload the report + uses: actions/upload-artifact@v3 + with: + name: coverage + path: coverage.md + + - name: Find the comment containing the report + id: fc + uses: peter-evans/find-comment@v2 + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: "github-actions[bot]" + body-includes: "Coverage Summary" + + - name: Create or update the report comment + uses: peter-evans/create-or-update-comment@v2 + if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body-file: ./coverage.md + edit-mode: replace From 29fbc2c3865c77bfbd73c42dce8e1c7dd839fd88 Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Wed, 27 Mar 2024 11:32:50 +0200 Subject: [PATCH 4/4] add test-coverage --- .github/workflows/actions.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index dba47b91c..56d357593 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -27,6 +27,7 @@ jobs: secrets: token: ${{ secrets.GITHUB_TOKEN }} + # TEMPORARY: Remove this job when we can upgrade to mx-sc-actions v3+ test_coverage: name: Test Coverage runs-on: ubuntu-latest