From dcb4ee50efcb83709d5af181232f4380d931eeae Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Fri, 26 Jul 2024 12:43:14 +0300 Subject: [PATCH 1/6] sc-meta tool - code-report --- .github/workflows/contracts.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 1e5643d..3e225bc 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -122,8 +122,7 @@ jobs: env: RUSTFLAGS: "" run: | - sc-meta all build-dbg --twiggy-paths --target-dir $(pwd)/target --path . - mxpy contract report --skip-build --skip-twiggy --output-format json --output-file report.json + sc-meta code-report --format json --path . --output report.json - name: Upload the report json if: ${{ inputs.enable-contracts-size-report }} @@ -149,9 +148,9 @@ jobs: if [ ! -f base-report/report.json ] then echo ":warning: Warning: Could not download the report for the base branch. Displaying only the report for the current branch. :warning:" >> report.md - mxpy contract report --compare report.json --output-format github-markdown --output-file report-table.md + sc-meta code-report --output report-table.md else - mxpy contract report --compare base-report/report.json report.json --output-format github-markdown --output-file report-table.md + sc-meta code-report --compare base-report/report.json --output report-table.md fi cat report-table.md >> report.md From f9483a0648e49620f3145a806924ff716c2445fb Mon Sep 17 00:00:00 2001 From: Laurentiu Ciobanu Date: Fri, 26 Jul 2024 10:32:40 +0000 Subject: [PATCH 2/6] always install sc-meta from path if specified --- .github/workflows/contracts.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 3e225bc..98d43d8 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -87,9 +87,7 @@ jobs: if [[ "${{ inputs.path-to-sc-meta }}" ]]; then cargo install --path ${{ inputs.path-to-sc-meta }} - fi - - if [[ -z "${{ inputs.sc-meta-version }}" ]]; + elif [[ -z "${{ inputs.sc-meta-version }}" ]]; then cargo install multiversx-sc-meta --locked else @@ -211,9 +209,7 @@ jobs: if [[ "${{ inputs.path-to-sc-meta }}" ]]; then cargo install --path ${{ inputs.path-to-sc-meta }} - fi - - if [[ -z "${{ inputs.sc-meta-version }}" ]]; + elif [[ -z "${{ inputs.sc-meta-version }}" ]]; then cargo install multiversx-sc-meta --locked else From 781c32994b8c6673b53ba204187e59978efe8fcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20B=C4=83ncioiu?= Date: Mon, 29 Jul 2024 14:23:16 +0300 Subject: [PATCH 3/6] Trial and error (downloading base report). --- .github/workflows/contracts.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 98d43d8..c30e88a 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -132,11 +132,11 @@ jobs: - name: Download the base report uses: dawidd6/action-download-artifact@v2 if: ${{ github.event_name == 'pull_request' && inputs.enable-contracts-size-report }} - continue-on-error: true + continue-on-error: false with: workflow: actions.yml name: report - commit: ${{ github.event.pull_request.base.sha && inputs.enable-contracts-size-report }} + commit: ${{ github.event.pull_request.base.sha }} path: base-report - name: Generate the report template From 3ccc32c6283f3e7106b324b742d10aae28827c15 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Mon, 5 Aug 2024 13:59:04 +0300 Subject: [PATCH 4/6] keep mxpy report in a separate command --- .github/workflows/contracts.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index c30e88a..cb3d233 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -115,14 +115,29 @@ jobs: RUSTFLAGS: "" run: cargo test --features multiversx-sc-scenario/run-go-tests - - name: Generate the contract report + - name: Generate the contract report via mxpy + if: ${{ inputs.enable-contracts-size-report }} + env: + RUSTFLAGS: "" + run: | + sc-meta all build-dbg --twiggy-paths --target-dir $(pwd)/target --path . + mxpy contract report --skip-build --skip-twiggy --output-format json --output-file report.json + + - name: Generate the contract report via sc-meta if: ${{ inputs.enable-contracts-size-report }} env: RUSTFLAGS: "" run: | sc-meta code-report --format json --path . --output report.json - - name: Upload the report json + - name: Upload the report json from mxpy + if: ${{ inputs.enable-contracts-size-report }} + uses: actions/upload-artifact@v3 + with: + name: mxpy_report + path: mxpy_report.json + + - name: Upload the report json from sc-meta if: ${{ inputs.enable-contracts-size-report }} uses: actions/upload-artifact@v3 with: @@ -132,7 +147,7 @@ jobs: - name: Download the base report uses: dawidd6/action-download-artifact@v2 if: ${{ github.event_name == 'pull_request' && inputs.enable-contracts-size-report }} - continue-on-error: false + continue-on-error: true with: workflow: actions.yml name: report @@ -146,9 +161,9 @@ jobs: if [ ! -f base-report/report.json ] then echo ":warning: Warning: Could not download the report for the base branch. Displaying only the report for the current branch. :warning:" >> report.md - sc-meta code-report --output report-table.md + sc-meta code-report --compare report.json --output report-table.md else - sc-meta code-report --compare base-report/report.json --output report-table.md + sc-meta code-report --compare report.json --compare base-report/report.json --output report-table.md fi cat report-table.md >> report.md From c50a21fcb5a9d85f01990402db58979085d920b1 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Mon, 5 Aug 2024 17:42:07 +0300 Subject: [PATCH 5/6] fix mxpy file --- .github/workflows/contracts.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index cb3d233..5c82326 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -121,7 +121,7 @@ jobs: RUSTFLAGS: "" run: | sc-meta all build-dbg --twiggy-paths --target-dir $(pwd)/target --path . - mxpy contract report --skip-build --skip-twiggy --output-format json --output-file report.json + mxpy contract report --skip-build --skip-twiggy --output-format json --output-file mxpy_report.json - name: Generate the contract report via sc-meta if: ${{ inputs.enable-contracts-size-report }} From 8b4ea39b4291e43e221aa6d980f6e97b34c8e1e8 Mon Sep 17 00:00:00 2001 From: BiancaIalangi Date: Fri, 9 Aug 2024 15:27:06 +0300 Subject: [PATCH 6/6] adapt to sc-meta report changes --- .github/workflows/contracts.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml index 5c82326..92ae3ab 100644 --- a/.github/workflows/contracts.yml +++ b/.github/workflows/contracts.yml @@ -128,7 +128,7 @@ jobs: env: RUSTFLAGS: "" run: | - sc-meta code-report --format json --path . --output report.json + sc-meta report compile --path . --output report.json - name: Upload the report json from mxpy if: ${{ inputs.enable-contracts-size-report }} @@ -158,13 +158,7 @@ jobs: if: ${{ github.event_name == 'pull_request' && inputs.enable-contracts-size-report }} run: | echo "Contract comparison - from {{ .base }} to {{ .head }}" > report.md - if [ ! -f base-report/report.json ] - then - echo ":warning: Warning: Could not download the report for the base branch. Displaying only the report for the current branch. :warning:" >> report.md - sc-meta code-report --compare report.json --output report-table.md - else - sc-meta code-report --compare report.json --compare base-report/report.json --output report-table.md - fi + sc-meta report compare --baseline base-report/report.json --new report.json --output report-table.md cat report-table.md >> report.md - name: Render the report from the template