From c3f6e877a88dd7dc75da27034437ab36217b3d50 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Wed, 31 Jul 2024 10:47:08 -0300 Subject: [PATCH 01/21] add simple wasm size check --- .github/workflows/build.yml | 44 +++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8352610fc..a80c81db24 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -320,6 +320,50 @@ jobs: name: moonbeam path: build + check-wasm-size: + name: "Check WASM runtimes with Twiggy" + runs-on: ubuntu-latest + needs: ["set-tags", "build"] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.set-tags.outputs.git_ref }} + # With rustup's nice new toml format, we just need to run rustup show to install the toolchain + # https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659 + - name: Setup Rust toolchain + run: | + rustup override unset + rustup show + - name: Download Twiggy + run: cargo install twiggy + - name: Lookup for latest target branch build + run: | + LATEST_TARGET_BRANCH_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,url,headBranch,event,status,conclusion,createdAt --jq '.[] | select(.headBranch == "master" and .event == "push" and .status == "completed" and .conclusion == "success") | .databaseId' | head -n 1) + echo "LATEST_TARGET_BRANCH_BUILD=$LATEST_TARGET_BRANCH_BUILD" >> $GITHUB_OUTPUT + - name: Download latest target branch build artifacts + run: | + gh run download $LATEST_TARGET_BRANCH_BUILD -n uncompressed-runtimes --dir uncompressed-runtimes-target-branch + gh run download $LATEST_TARGET_BRANCH_BUILD -n runtimes --dir runtimes-target-branch + - name: Check Runtimes size for target branch + run: | + echo $(ls -lh runtimes) >> $GITHUB_OUTPUT + echo $(ls -lh uncompressed-runtimes) >> $GITHUB_OUTPUT + - name: "Download branch built runtime" + uses: actions/download-artifact@v4 + with: + name: runtimes + path: runtimes-current-branch + - name: "Download branch built uncompressed-runtimes" + uses: actions/download-artifact@v4 + with: + name: uncompressed-runtimes + path: uncompressed-runtimes-current-branch + - name: Check Runtimes size for current branch + run: | + echo $(ls -lh runtimes-current-branch) >> $GITHUB_OUTPUT + echo $(ls -lh uncompressed-runtimes-current-branch) >> $GITHUB_OUTPUT + rust-test: runs-on: labels: bare-metal From 7955d1100c42a18c65f23c995efb2ca9d0175016 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Wed, 31 Jul 2024 10:49:59 -0300 Subject: [PATCH 02/21] only run on pull requests --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a80c81db24..9408b6380f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -323,6 +323,7 @@ jobs: check-wasm-size: name: "Check WASM runtimes with Twiggy" runs-on: ubuntu-latest + if: github.event_name == 'pull_request' needs: ["set-tags", "build"] steps: - name: Checkout From a5d7ee9ed6e285da8cf6b7797111ac62d18877ca Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Wed, 31 Jul 2024 11:05:41 -0300 Subject: [PATCH 03/21] add Github token to env --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9408b6380f..b2b07e91ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -325,6 +325,8 @@ jobs: runs-on: ubuntu-latest if: github.event_name == 'pull_request' needs: ["set-tags", "build"] + env: + GH_TOKEN: ${{ github.token }} steps: - name: Checkout uses: actions/checkout@v4 From a318142f45a9cb6271fe2ebda2fae6987cc64710 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Wed, 31 Jul 2024 11:21:25 -0300 Subject: [PATCH 04/21] fix download dir name --- .github/workflows/build.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b2b07e91ca..73a408d4fd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -350,8 +350,8 @@ jobs: gh run download $LATEST_TARGET_BRANCH_BUILD -n runtimes --dir runtimes-target-branch - name: Check Runtimes size for target branch run: | - echo $(ls -lh runtimes) >> $GITHUB_OUTPUT - echo $(ls -lh uncompressed-runtimes) >> $GITHUB_OUTPUT + echo $(ls -lh runtimes-target-branch) + echo $(ls -lh uncompressed-runtimes-target-branch) - name: "Download branch built runtime" uses: actions/download-artifact@v4 with: @@ -364,8 +364,8 @@ jobs: path: uncompressed-runtimes-current-branch - name: Check Runtimes size for current branch run: | - echo $(ls -lh runtimes-current-branch) >> $GITHUB_OUTPUT - echo $(ls -lh uncompressed-runtimes-current-branch) >> $GITHUB_OUTPUT + echo $(ls -lh runtimes-current-branch) + echo $(ls -lh uncompressed-runtimes-current-branch) rust-test: runs-on: From 952b3e5084375b47767d22b96f53aa87c09c5d72 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Thu, 1 Aug 2024 15:19:37 -0300 Subject: [PATCH 05/21] try comparing previous and current runtimes --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73a408d4fd..ea0ef48ea9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -350,8 +350,12 @@ jobs: gh run download $LATEST_TARGET_BRANCH_BUILD -n runtimes --dir runtimes-target-branch - name: Check Runtimes size for target branch run: | - echo $(ls -lh runtimes-target-branch) - echo $(ls -lh uncompressed-runtimes-target-branch) + PREVIOUS_MOONBASE=$(du -k runtimes-target-branch/* | awk '/moonbase_runtime/ {print $1}') + PREVIOUS_MOONBEAM=$(du -k runtimes-target-branch/* | awk '/moonbeam_runtime/ {print $1}') + PREVIOUS_MOONRIVER=$(du -k runtimes-target-branch/* | awk '/moonriver_runtime/ {print $1}') + echo "PREVIOUS_MOONBASE=$PREVIOUS_MOONBASE" >> $GITHUB_ENV + echo "PREVIOUS_MOONBEAM=$PREVIOUS_MOONBEAM" >> $GITHUB_ENV + echo "PREVIOUS_MOONRIVER=$PREVIOUS_MOONRIVER" >> $GITHUB_ENV - name: "Download branch built runtime" uses: actions/download-artifact@v4 with: @@ -364,8 +368,39 @@ jobs: path: uncompressed-runtimes-current-branch - name: Check Runtimes size for current branch run: | - echo $(ls -lh runtimes-current-branch) - echo $(ls -lh uncompressed-runtimes-current-branch) + CURRENT_MOONBASE=$(du -k runtimes-current-branch/* | awk '/moonbase_runtime/ {print $1}') + CURRENT_MOONBEAM=$(du -k runtimes-current-branch/* | awk '/moonbeam_runtime/ {print $1}') + CURRENT_MOONRIVER=$(du -k runtimes-current-branch/* | awk '/moonriver_runtime/ {print $1}') + echo "CURRENT_MOONBASE=$CURRENT_MOONBASE" >> $GITHUB_ENV + echo "CURRENT_MOONBEAM=$CURRENT_MOONBEAM" >> $GITHUB_ENV + echo "CURRENT_MOONRIVER=$CURRENT_MOONRIVER" >> $GITHUB_ENV + - name: Compare Runtimes sizes + run: | + MOONBASE_DIFF=$((CURRENT_MOONBASE - PREVIOUS_MOONBASE)) + MOONBEAM_DIFF=$((CURRENT_MOONBEAM - PREVIOUS_MOONBEAM)) + MOONRIVER_DIFF=$((CURRENT_MOONRIVER - PREVIOUS_MOONRIVER)) + + if [ $MOONBASE_DIFF -eq 0 ]; then + MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB (no changes)" + else + MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_DIFF} KB)" + fi + + if [ $MOONBEAM_DIFF -eq 0 ]; then + MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB (no changes)" + else + MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_DIFF -gt 0 ] && echo "+" )${MOONBEAM_DIFF} KB)" + fi + + if [ $MOONRIVER_DIFF -eq 0 ]; then + MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB (no changes)" + else + MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_DIFF -gt 0 ] && echo "+" )${MOONRIVER_DIFF} KB)" + fi + + echo $MOONBASE_MSG + echo $MOONBEAM_MSG + echo $MOONRIVER_MSG rust-test: runs-on: From 1ad61b3d65d74274254d42300d18e95f42e7e9c6 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Thu, 1 Aug 2024 15:51:33 -0300 Subject: [PATCH 06/21] change master branch with dynamic target branch ref --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ea0ef48ea9..5d9545ff08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -342,7 +342,8 @@ jobs: run: cargo install twiggy - name: Lookup for latest target branch build run: | - LATEST_TARGET_BRANCH_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,url,headBranch,event,status,conclusion,createdAt --jq '.[] | select(.headBranch == "master" and .event == "push" and .status == "completed" and .conclusion == "success") | .databaseId' | head -n 1) + TARGET_BRANCH=${{ github.event.pull_request.base.ref }} + LATEST_TARGET_BRANCH_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,url,headBranch,event,status,conclusion,createdAt --jq ".[] | select(.headBranch == \"$TARGET_BRANCH\" and .event == \"push\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -n 1) echo "LATEST_TARGET_BRANCH_BUILD=$LATEST_TARGET_BRANCH_BUILD" >> $GITHUB_OUTPUT - name: Download latest target branch build artifacts run: | From e490f9cbc39bcfe69909358f5d825317105cbf11 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Thu, 1 Aug 2024 16:01:11 -0300 Subject: [PATCH 07/21] add comparison to latest release --- .github/workflows/build.yml | 48 +++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d9545ff08..63d6ba0f17 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -375,6 +375,27 @@ jobs: echo "CURRENT_MOONBASE=$CURRENT_MOONBASE" >> $GITHUB_ENV echo "CURRENT_MOONBEAM=$CURRENT_MOONBEAM" >> $GITHUB_ENV echo "CURRENT_MOONRIVER=$CURRENT_MOONRIVER" >> $GITHUB_ENV + - name: Fetch latest release tag + id: fetch_latest_release + run: | + LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) + echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV + - name: Checkout latest release + uses: actions/checkout@v4 + with: + ref: ${{ env.LATEST_RELEASE_TAG }} + - name: Download latest release artifacts + run: | + gh run download -n uncompressed-runtimes --dir uncompressed-runtimes-latest-release + gh run download -n runtimes --dir runtimes-latest-release + - name: Check Runtimes size for latest release + run: | + LATEST_MOONBASE=$(du -k runtimes-latest-release/* | awk '/moonbase_runtime/ {print $1}') + LATEST_MOONBEAM=$(du -k runtimes-latest-release/* | awk '/moonbeam_runtime/ {print $1}') + LATEST_MOONRIVER=$(du -k runtimes-latest-release/* | awk '/moonriver_runtime/ {print $1}') + echo "LATEST_MOONBASE=$LATEST_MOONBASE" >> $GITHUB_ENV + echo "LATEST_MOONBEAM=$LATEST_MOONBEAM" >> $GITHUB_ENV + echo "LATEST_MOONRIVER=$LATEST_MOONRIVER" >> $GITHUB_ENV - name: Compare Runtimes sizes run: | MOONBASE_DIFF=$((CURRENT_MOONBASE - PREVIOUS_MOONBASE)) @@ -402,6 +423,33 @@ jobs: echo $MOONBASE_MSG echo $MOONBEAM_MSG echo $MOONRIVER_MSG + - name: Compare with latest release + run: | + MOONBASE_RELEASE_DIFF=$((CURRENT_MOONBASE - LATEST_MOONBASE)) + MOONBEAM_RELEASE_DIFF=$((CURRENT_MOONBEAM - LATEST_MOONBEAM)) + MOONRIVER_RELEASE_DIFF=$((CURRENT_MOONRIVER - LATEST_MOONRIVER)) + + if [ $MOONBASE_RELEASE_DIFF -eq 0 ]; then + MOONBASE_RELEASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB (no changes compared to latest release)" + else + MOONBASE_RELEASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_RELEASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_RELEASE_DIFF} KB compared to latest release)" + fi + + if [ $MOONBEAM_RELEASE_DIFF -eq 0 ]; then + MOONBEAM_RELEASE_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB (no changes compared to latest release)" + else + MOONBEAM_RELEASE_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_RELEASE_DIFF -gt 0 ] && echo "+" )${MOONBEAM_RELEASE_DIFF} KB compared to latest release)" + fi + + if [ $MOONRIVER_RELEASE_DIFF -eq 0 ]; then + MOONRIVER_RELEASE_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB (no changes compared to latest release)" + else + MOONRIVER_RELEASE_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_RELEASE_DIFF -gt 0 ] && echo "+" )${MOONRIVER_RELEASE_DIFF} KB compared to latest release)" + fi + + echo $MOONBASE_RELEASE_MSG + echo $MOONBEAM_RELEASE_MSG + echo $MOONRIVER_RELEASE_MSG rust-test: runs-on: From 38fa092b6d54cc906d2b6b2da1c97c1b392ad9cb Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Thu, 1 Aug 2024 16:23:09 -0300 Subject: [PATCH 08/21] test with older release --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 63d6ba0f17..cf08de87e2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -378,7 +378,8 @@ jobs: - name: Fetch latest release tag id: fetch_latest_release run: | - LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) + : # LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) + LATEST_RELEASE_TAG=runtime-2400 echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV - name: Checkout latest release uses: actions/checkout@v4 From 75bde94b4bd07d477a657d6c98328bb9a7af250f Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Thu, 1 Aug 2024 16:48:05 -0300 Subject: [PATCH 09/21] download from release instead of workflow artifact --- .github/workflows/build.yml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cf08de87e2..a43cedd091 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -378,17 +378,15 @@ jobs: - name: Fetch latest release tag id: fetch_latest_release run: | - : # LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) - LATEST_RELEASE_TAG=runtime-2400 + LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV - - name: Checkout latest release - uses: actions/checkout@v4 - with: - ref: ${{ env.LATEST_RELEASE_TAG }} - - name: Download latest release artifacts + - name: Lookup for latest release build + run: | + LATEST_RELEASE_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,url,headBranch,event,status,conclusion,createdAt --jq ".[] | select(.headBranch == \"$LATEST_RELEASE_TAG\" and .event == \"push\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -n 1) + echo "LATEST_RELEASE_BUILD=$LATEST_RELEASE_BUILD" >> $GITHUB_OUTPUT + - name: Download latest release build artifacts run: | - gh run download -n uncompressed-runtimes --dir uncompressed-runtimes-latest-release - gh run download -n runtimes --dir runtimes-latest-release + gh release download $LATEST_RELEASE_TAG -R moonbeam-foundation/moonbeam -p "moonbeam-runtime-3100.wasm" -p "moonbase-runtime-3100.wasm" -p "moonriver-runtime-3100.wasm" --dir runtimes-latest-release - name: Check Runtimes size for latest release run: | LATEST_MOONBASE=$(du -k runtimes-latest-release/* | awk '/moonbase_runtime/ {print $1}') From 6e0884f6966ad1d610e9ea34ac6d074960e75e01 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 10:31:39 -0300 Subject: [PATCH 10/21] debug release tag not saved to env --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a43cedd091..1b57ef4951 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -380,6 +380,7 @@ jobs: run: | LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV + echo $LATEST_RELEASE_TAG - name: Lookup for latest release build run: | LATEST_RELEASE_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,url,headBranch,event,status,conclusion,createdAt --jq ".[] | select(.headBranch == \"$LATEST_RELEASE_TAG\" and .event == \"push\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -n 1) From c4840890e55324209495cea3fa9178fd9cba509a Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 11:05:54 -0300 Subject: [PATCH 11/21] debug some more --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b57ef4951..1ccf5534a4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -378,6 +378,7 @@ jobs: - name: Fetch latest release tag id: fetch_latest_release run: | + git tag -l 'runtime-*' | sort -V | tail -n 1 LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV echo $LATEST_RELEASE_TAG From 135e0ad7e405888b8a6a07816b1830845346c6ce Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 12:10:02 -0300 Subject: [PATCH 12/21] use gh cli to get releases instead of git tag --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1ccf5534a4..e15d8d231a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -378,9 +378,9 @@ jobs: - name: Fetch latest release tag id: fetch_latest_release run: | - git tag -l 'runtime-*' | sort -V | tail -n 1 - LATEST_RELEASE_TAG=$(git tag -l 'runtime-*' | sort -V | tail -n 1) + LATEST_RELEASE_TAG=$(gh release list --repo moonbeam-foundation/moonbeam --limit 100 --json tagName -q '.[] | select(.tagName | test("^runtime-\\d+$")) | .tagName' | sort -V | tail -n 1) echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV + echo "::set-output name=LATEST_RELEASE_TAG::$LATEST_RELEASE_TAG" echo $LATEST_RELEASE_TAG - name: Lookup for latest release build run: | From 70b7a2e7f902b0bf2e2a84fbf59e4edeb54bb640 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 12:19:57 -0300 Subject: [PATCH 13/21] use gh api instead of releases --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e15d8d231a..8ddde85a70 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -378,7 +378,7 @@ jobs: - name: Fetch latest release tag id: fetch_latest_release run: | - LATEST_RELEASE_TAG=$(gh release list --repo moonbeam-foundation/moonbeam --limit 100 --json tagName -q '.[] | select(.tagName | test("^runtime-\\d+$")) | .tagName' | sort -V | tail -n 1) + LATEST_RELEASE_TAG=$(gh api repos/moonbeam-foundation/moonbeam/releases --paginate --jq '.[] | select(.tag_name | test("^runtime-\\d+$")) | .tag_name' | sort -V | tail -n 1) echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV echo "::set-output name=LATEST_RELEASE_TAG::$LATEST_RELEASE_TAG" echo $LATEST_RELEASE_TAG From 857b3b7959c68032a3dfcaa17340b63433c7dd37 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 13:36:03 -0300 Subject: [PATCH 14/21] remove get build id & fix awk parsing --- .github/workflows/build.yml | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ddde85a70..3ff4614e84 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -351,9 +351,9 @@ jobs: gh run download $LATEST_TARGET_BRANCH_BUILD -n runtimes --dir runtimes-target-branch - name: Check Runtimes size for target branch run: | - PREVIOUS_MOONBASE=$(du -k runtimes-target-branch/* | awk '/moonbase_runtime/ {print $1}') - PREVIOUS_MOONBEAM=$(du -k runtimes-target-branch/* | awk '/moonbeam_runtime/ {print $1}') - PREVIOUS_MOONRIVER=$(du -k runtimes-target-branch/* | awk '/moonriver_runtime/ {print $1}') + PREVIOUS_MOONBASE=$(du -k runtimes-target-branch/* | awk '/moonbase-runtime/ {print $1}') + PREVIOUS_MOONBEAM=$(du -k runtimes-target-branch/* | awk '/moonbeam-runtime/ {print $1}') + PREVIOUS_MOONRIVER=$(du -k runtimes-target-branch/* | awk '/moonriver-runtime/ {print $1}') echo "PREVIOUS_MOONBASE=$PREVIOUS_MOONBASE" >> $GITHUB_ENV echo "PREVIOUS_MOONBEAM=$PREVIOUS_MOONBEAM" >> $GITHUB_ENV echo "PREVIOUS_MOONRIVER=$PREVIOUS_MOONRIVER" >> $GITHUB_ENV @@ -369,9 +369,9 @@ jobs: path: uncompressed-runtimes-current-branch - name: Check Runtimes size for current branch run: | - CURRENT_MOONBASE=$(du -k runtimes-current-branch/* | awk '/moonbase_runtime/ {print $1}') - CURRENT_MOONBEAM=$(du -k runtimes-current-branch/* | awk '/moonbeam_runtime/ {print $1}') - CURRENT_MOONRIVER=$(du -k runtimes-current-branch/* | awk '/moonriver_runtime/ {print $1}') + CURRENT_MOONBASE=$(du -k runtimes-current-branch/* | awk '/moonbase-runtime/ {print $1}') + CURRENT_MOONBEAM=$(du -k runtimes-current-branch/* | awk '/moonbeam-runtime/ {print $1}') + CURRENT_MOONRIVER=$(du -k runtimes-current-branch/* | awk '/moonriver-runtime/ {print $1}') echo "CURRENT_MOONBASE=$CURRENT_MOONBASE" >> $GITHUB_ENV echo "CURRENT_MOONBEAM=$CURRENT_MOONBEAM" >> $GITHUB_ENV echo "CURRENT_MOONRIVER=$CURRENT_MOONRIVER" >> $GITHUB_ENV @@ -382,18 +382,14 @@ jobs: echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV echo "::set-output name=LATEST_RELEASE_TAG::$LATEST_RELEASE_TAG" echo $LATEST_RELEASE_TAG - - name: Lookup for latest release build + - name: Download latest release runtimes run: | - LATEST_RELEASE_BUILD=$(gh run -R moonbeam-foundation/moonbeam list -w Build --limit=100 --json databaseId,url,headBranch,event,status,conclusion,createdAt --jq ".[] | select(.headBranch == \"$LATEST_RELEASE_TAG\" and .event == \"push\" and .status == \"completed\" and .conclusion == \"success\") | .databaseId" | head -n 1) - echo "LATEST_RELEASE_BUILD=$LATEST_RELEASE_BUILD" >> $GITHUB_OUTPUT - - name: Download latest release build artifacts - run: | - gh release download $LATEST_RELEASE_TAG -R moonbeam-foundation/moonbeam -p "moonbeam-runtime-3100.wasm" -p "moonbase-runtime-3100.wasm" -p "moonriver-runtime-3100.wasm" --dir runtimes-latest-release + gh release download $LATEST_RELEASE_TAG -R moonbeam-foundation/moonbeam -p "moonbeam-runtime-${LATEST_RELEASE_TAG#runtime-}.wasm" -p "moonbase-runtime-${LATEST_RELEASE_TAG#runtime-}.wasm" -p "moonriver-runtime-${LATEST_RELEASE_TAG#runtime-}.wasm" --dir runtimes-latest-release - name: Check Runtimes size for latest release run: | - LATEST_MOONBASE=$(du -k runtimes-latest-release/* | awk '/moonbase_runtime/ {print $1}') - LATEST_MOONBEAM=$(du -k runtimes-latest-release/* | awk '/moonbeam_runtime/ {print $1}') - LATEST_MOONRIVER=$(du -k runtimes-latest-release/* | awk '/moonriver_runtime/ {print $1}') + LATEST_MOONBASE=$(du -k runtimes-latest-release/* | awk '/moonbase-runtime/ {print $1}') + LATEST_MOONBEAM=$(du -k runtimes-latest-release/* | awk '/moonbeam-runtime/ {print $1}') + LATEST_MOONRIVER=$(du -k runtimes-latest-release/* | awk '/moonriver-runtime/ {print $1}') echo "LATEST_MOONBASE=$LATEST_MOONBASE" >> $GITHUB_ENV echo "LATEST_MOONBEAM=$LATEST_MOONBEAM" >> $GITHUB_ENV echo "LATEST_MOONRIVER=$LATEST_MOONRIVER" >> $GITHUB_ENV From 05b1fca6ed73d402306d11b224016d51d216cfa6 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 13:40:02 -0300 Subject: [PATCH 15/21] build runtimes with _, releases with - --- .github/workflows/build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3ff4614e84..078dfa6df1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -351,9 +351,9 @@ jobs: gh run download $LATEST_TARGET_BRANCH_BUILD -n runtimes --dir runtimes-target-branch - name: Check Runtimes size for target branch run: | - PREVIOUS_MOONBASE=$(du -k runtimes-target-branch/* | awk '/moonbase-runtime/ {print $1}') - PREVIOUS_MOONBEAM=$(du -k runtimes-target-branch/* | awk '/moonbeam-runtime/ {print $1}') - PREVIOUS_MOONRIVER=$(du -k runtimes-target-branch/* | awk '/moonriver-runtime/ {print $1}') + PREVIOUS_MOONBASE=$(du -k runtimes-target-branch/* | awk '/moonbase_runtime/ {print $1}') + PREVIOUS_MOONBEAM=$(du -k runtimes-target-branch/* | awk '/moonbeam_runtime/ {print $1}') + PREVIOUS_MOONRIVER=$(du -k runtimes-target-branch/* | awk '/moonriver_runtime/ {print $1}') echo "PREVIOUS_MOONBASE=$PREVIOUS_MOONBASE" >> $GITHUB_ENV echo "PREVIOUS_MOONBEAM=$PREVIOUS_MOONBEAM" >> $GITHUB_ENV echo "PREVIOUS_MOONRIVER=$PREVIOUS_MOONRIVER" >> $GITHUB_ENV @@ -369,9 +369,9 @@ jobs: path: uncompressed-runtimes-current-branch - name: Check Runtimes size for current branch run: | - CURRENT_MOONBASE=$(du -k runtimes-current-branch/* | awk '/moonbase-runtime/ {print $1}') - CURRENT_MOONBEAM=$(du -k runtimes-current-branch/* | awk '/moonbeam-runtime/ {print $1}') - CURRENT_MOONRIVER=$(du -k runtimes-current-branch/* | awk '/moonriver-runtime/ {print $1}') + CURRENT_MOONBASE=$(du -k runtimes-current-branch/* | awk '/moonbase_runtime/ {print $1}') + CURRENT_MOONBEAM=$(du -k runtimes-current-branch/* | awk '/moonbeam_runtime/ {print $1}') + CURRENT_MOONRIVER=$(du -k runtimes-current-branch/* | awk '/moonriver_runtime/ {print $1}') echo "CURRENT_MOONBASE=$CURRENT_MOONBASE" >> $GITHUB_ENV echo "CURRENT_MOONBEAM=$CURRENT_MOONBEAM" >> $GITHUB_ENV echo "CURRENT_MOONRIVER=$CURRENT_MOONRIVER" >> $GITHUB_ENV From d375beeec025702323f782c99c0da342e7d2def9 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Fri, 2 Aug 2024 15:51:47 -0300 Subject: [PATCH 16/21] add comment to PR and format msg --- .github/workflows/build.yml | 92 ++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 078dfa6df1..5c759133db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -399,54 +399,50 @@ jobs: MOONBEAM_DIFF=$((CURRENT_MOONBEAM - PREVIOUS_MOONBEAM)) MOONRIVER_DIFF=$((CURRENT_MOONRIVER - PREVIOUS_MOONRIVER)) - if [ $MOONBASE_DIFF -eq 0 ]; then - MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB (no changes)" - else - MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_DIFF} KB)" - fi - - if [ $MOONBEAM_DIFF -eq 0 ]; then - MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB (no changes)" - else - MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_DIFF -gt 0 ] && echo "+" )${MOONBEAM_DIFF} KB)" - fi - - if [ $MOONRIVER_DIFF -eq 0 ]; then - MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB (no changes)" - else - MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_DIFF -gt 0 ] && echo "+" )${MOONRIVER_DIFF} KB)" - fi - - echo $MOONBASE_MSG - echo $MOONBEAM_MSG - echo $MOONRIVER_MSG - - name: Compare with latest release - run: | - MOONBASE_RELEASE_DIFF=$((CURRENT_MOONBASE - LATEST_MOONBASE)) - MOONBEAM_RELEASE_DIFF=$((CURRENT_MOONBEAM - LATEST_MOONBEAM)) - MOONRIVER_RELEASE_DIFF=$((CURRENT_MOONRIVER - LATEST_MOONRIVER)) - - if [ $MOONBASE_RELEASE_DIFF -eq 0 ]; then - MOONBASE_RELEASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB (no changes compared to latest release)" - else - MOONBASE_RELEASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_RELEASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_RELEASE_DIFF} KB compared to latest release)" - fi - - if [ $MOONBEAM_RELEASE_DIFF -eq 0 ]; then - MOONBEAM_RELEASE_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB (no changes compared to latest release)" - else - MOONBEAM_RELEASE_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_RELEASE_DIFF -gt 0 ] && echo "+" )${MOONBEAM_RELEASE_DIFF} KB compared to latest release)" - fi - - if [ $MOONRIVER_RELEASE_DIFF -eq 0 ]; then - MOONRIVER_RELEASE_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB (no changes compared to latest release)" - else - MOONRIVER_RELEASE_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_RELEASE_DIFF -gt 0 ] && echo "+" )${MOONRIVER_RELEASE_DIFF} KB compared to latest release)" - fi - - echo $MOONBASE_RELEASE_MSG - echo $MOONBEAM_RELEASE_MSG - echo $MOONRIVER_RELEASE_MSG + LATEST_MOONBASE_DIFF=$((CURRENT_MOONBASE - LATEST_MOONBASE)) + LATEST_MOONBEAM_DIFF=$((CURRENT_MOONBEAM - LATEST_MOONBEAM)) + LATEST_MOONRIVER_DIFF=$((CURRENT_MOONRIVER - LATEST_MOONRIVER)) + + get_status_emoji() { + local size=$1 + local diff=$2 + if [ $size -gt 2400 ]; then + echo "🚨" + elif [ $diff -gt 0 ]; then + echo "⚠️" + else + echo "✅" + fi + } + + MOONBASE_STATUS=$(get_status_emoji $CURRENT_MOONBASE $MOONBASE_DIFF) + MOONBEAM_STATUS=$(get_status_emoji $CURRENT_MOONBEAM $MOONBEAM_DIFF) + MOONRIVER_STATUS=$(get_status_emoji $CURRENT_MOONRIVER $MOONRIVER_DIFF) + + MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_DIFF} KB"))" + MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBEAM_DIFF -gt 0 ] && echo "+" )${MOONBEAM_DIFF} KB"))" + MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONRIVER_DIFF -gt 0 ] && echo "+" )${MOONRIVER_DIFF} KB"))" + + LATEST_MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $LATEST_MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBASE_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBASE_DIFF} KB compared to latest release"))" + LATEST_MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $LATEST_MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBEAM_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBEAM_DIFF} KB compared to latest release"))" + LATEST_MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $LATEST_MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONRIVER_DIFF -gt 0 ] && echo "+" )${LATEST_MOONRIVER_DIFF} KB compared to latest release"))" + + echo "$MOONBASE_MSG" + echo "$MOONBEAM_MSG" + echo "$MOONRIVER_MSG" + echo "$LATEST_MOONBASE_MSG" + echo "$LATEST_MOONBEAM_MSG" + echo "$LATEST_MOONRIVER_MSG" + + echo "MOONBASE_MSG=$MOONBASE_MSG" >> $GITHUB_ENV + echo "MOONBEAM_MSG=$MOONBEAM_MSG" >> $GITHUB_ENV + echo "MOONRIVER_MSG=$MOONRIVER_MSG" >> $GITHUB_ENV + echo "LATEST_MOONBASE_MSG=$LATEST_MOONBASE_MSG" >> $GITHUB_ENV + echo "LATEST_MOONBEAM_MSG=$LATEST_MOONBEAM_MSG" >> $GITHUB_ENV + echo "LATEST_MOONRIVER_MSG=$LATEST_MOONRIVER_MSG" >> $GITHUB_ENV + - name: Post comparison results to PR discussion + run: | + gh pr comment ${{ github.event.pull_request.number }} --body "### WASM runtime size check:\n\n#### Compared to target branch ${MOONBASE_STATUS}\n\n$MOONBASE_MSG\n\n$MOONBEAM_MSG\n\n$MOONRIVER_MSG\n\n#### Compared to latest release (${LATEST_RELEASE_TAG}) ${MOONBASE_STATUS}\n\n$LATEST_MOONBASE_MSG\n\n$LATEST_MOONBEAM_MSG\n\n$LATEST_MOONRIVER_MSG" rust-test: runs-on: From 6ca80ba00768f1f8f606d4e1c435a6343c5e9a05 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Mon, 5 Aug 2024 08:55:10 -0300 Subject: [PATCH 17/21] use markdown report & replace comment --- .github/workflows/build.yml | 63 +++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c759133db..843eaa3f8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -419,30 +419,45 @@ jobs: MOONBEAM_STATUS=$(get_status_emoji $CURRENT_MOONBEAM $MOONBEAM_DIFF) MOONRIVER_STATUS=$(get_status_emoji $CURRENT_MOONRIVER $MOONRIVER_DIFF) - MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_DIFF} KB"))" - MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBEAM_DIFF -gt 0 ] && echo "+" )${MOONBEAM_DIFF} KB"))" - MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONRIVER_DIFF -gt 0 ] && echo "+" )${MOONRIVER_DIFF} KB"))" - - LATEST_MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $LATEST_MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBASE_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBASE_DIFF} KB compared to latest release"))" - LATEST_MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $LATEST_MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBEAM_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBEAM_DIFF} KB compared to latest release"))" - LATEST_MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $LATEST_MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONRIVER_DIFF -gt 0 ] && echo "+" )${LATEST_MOONRIVER_DIFF} KB compared to latest release"))" - - echo "$MOONBASE_MSG" - echo "$MOONBEAM_MSG" - echo "$MOONRIVER_MSG" - echo "$LATEST_MOONBASE_MSG" - echo "$LATEST_MOONBEAM_MSG" - echo "$LATEST_MOONRIVER_MSG" - - echo "MOONBASE_MSG=$MOONBASE_MSG" >> $GITHUB_ENV - echo "MOONBEAM_MSG=$MOONBEAM_MSG" >> $GITHUB_ENV - echo "MOONRIVER_MSG=$MOONRIVER_MSG" >> $GITHUB_ENV - echo "LATEST_MOONBASE_MSG=$LATEST_MOONBASE_MSG" >> $GITHUB_ENV - echo "LATEST_MOONBEAM_MSG=$LATEST_MOONBEAM_MSG" >> $GITHUB_ENV - echo "LATEST_MOONRIVER_MSG=$LATEST_MOONRIVER_MSG" >> $GITHUB_ENV - - name: Post comparison results to PR discussion - run: | - gh pr comment ${{ github.event.pull_request.number }} --body "### WASM runtime size check:\n\n#### Compared to target branch ${MOONBASE_STATUS}\n\n$MOONBASE_MSG\n\n$MOONBEAM_MSG\n\n$MOONRIVER_MSG\n\n#### Compared to latest release (${LATEST_RELEASE_TAG}) ${MOONBASE_STATUS}\n\n$LATEST_MOONBASE_MSG\n\n$LATEST_MOONBEAM_MSG\n\n$LATEST_MOONRIVER_MSG" + MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_DIFF} KB")) ${MOONBASE_STATUS}" + MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBEAM_DIFF -gt 0 ] && echo "+" )${MOONBEAM_DIFF} KB")) ${MOONBEAM_STATUS}" + MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONRIVER_DIFF -gt 0 ] && echo "+" )${MOONRIVER_DIFF} KB")) ${MOONRIVER_STATUS}" + + LATEST_MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $LATEST_MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBASE_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBASE_DIFF} KB compared to latest release")) ${MOONBASE_STATUS}" + LATEST_MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $LATEST_MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBEAM_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBEAM_DIFF} KB compared to latest release")) ${MOONBEAM_STATUS}" + LATEST_MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $LATEST_MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONRIVER_DIFF -gt 0 ] && echo "+" )${LATEST_MOONRIVER_DIFF} KB compared to latest release")) ${MOONRIVER_STATUS}" + + echo "### WASM runtime size check:" > runtime_size_report.md + echo "" >> runtime_size_report.md + echo "#### Compared to target branch ${MOONBASE_STATUS}" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "$MOONBASE_MSG" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "$MOONBEAM_MSG" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "$MOONRIVER_MSG" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "#### Compared to latest release (${LATEST_RELEASE_TAG}) ${MOONBASE_STATUS}" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "$LATEST_MOONBASE_MSG" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "$LATEST_MOONBEAM_MSG" >> runtime_size_report.md + echo "" >> runtime_size_report.md + echo "$LATEST_MOONRIVER_MSG" >> runtime_size_report.md + - name: Find Comment + uses: peter-evans/find-comment@v3 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: "github-actions[bot]" + body-includes: "WASM runtime size check" + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v4 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body-path: runtime_size_report.md + edit-mode: replace rust-test: runs-on: From ae7b4ec44e509411ca709efc97e76723c62b17a4 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Mon, 5 Aug 2024 09:12:40 -0300 Subject: [PATCH 18/21] cat report & fix comment formatting --- .github/workflows/build.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 843eaa3f8a..52713f4e51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -395,6 +395,9 @@ jobs: echo "LATEST_MOONRIVER=$LATEST_MOONRIVER" >> $GITHUB_ENV - name: Compare Runtimes sizes run: | + # Create or truncate the file + echo "" > runtime_size_report.md + MOONBASE_DIFF=$((CURRENT_MOONBASE - PREVIOUS_MOONBASE)) MOONBEAM_DIFF=$((CURRENT_MOONBEAM - PREVIOUS_MOONBEAM)) MOONRIVER_DIFF=$((CURRENT_MOONRIVER - PREVIOUS_MOONRIVER)) @@ -419,17 +422,21 @@ jobs: MOONBEAM_STATUS=$(get_status_emoji $CURRENT_MOONBEAM $MOONBEAM_DIFF) MOONRIVER_STATUS=$(get_status_emoji $CURRENT_MOONRIVER $MOONRIVER_DIFF) + LATEST_MOONBASE_STATUS=$(get_status_emoji $CURRENT_MOONBASE $LATEST_MOONBASE_DIFF) + LATEST_MOONBEAM_STATUS=$(get_status_emoji $CURRENT_MOONBEAM $LATEST_MOONBEAM_DIFF) + LATEST_MOONRIVER_STATUS=$(get_status_emoji $CURRENT_MOONRIVER $LATEST_MOONRIVER_DIFF) + MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBASE_DIFF -gt 0 ] && echo "+" )${MOONBASE_DIFF} KB")) ${MOONBASE_STATUS}" MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONBEAM_DIFF -gt 0 ] && echo "+" )${MOONBEAM_DIFF} KB")) ${MOONBEAM_STATUS}" MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $MOONRIVER_DIFF -gt 0 ] && echo "+" )${MOONRIVER_DIFF} KB")) ${MOONRIVER_STATUS}" - LATEST_MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $LATEST_MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBASE_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBASE_DIFF} KB compared to latest release")) ${MOONBASE_STATUS}" - LATEST_MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $LATEST_MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBEAM_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBEAM_DIFF} KB compared to latest release")) ${MOONBEAM_STATUS}" - LATEST_MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $LATEST_MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONRIVER_DIFF -gt 0 ] && echo "+" )${LATEST_MOONRIVER_DIFF} KB compared to latest release")) ${MOONRIVER_STATUS}" + LATEST_MOONBASE_MSG="Moonbase runtime: ${CURRENT_MOONBASE} KB ($( [ $LATEST_MOONBASE_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBASE_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBASE_DIFF} KB compared to latest release")) ${LATEST_MOONBASE_STATUS}" + LATEST_MOONBEAM_MSG="Moonbeam runtime: ${CURRENT_MOONBEAM} KB ($( [ $LATEST_MOONBEAM_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONBEAM_DIFF -gt 0 ] && echo "+" )${LATEST_MOONBEAM_DIFF} KB compared to latest release")) ${LATEST_MOONBEAM_STATUS}" + LATEST_MOONRIVER_MSG="Moonriver runtime: ${CURRENT_MOONRIVER} KB ($( [ $LATEST_MOONRIVER_DIFF -eq 0 ] && echo "no changes" || echo "$( [ $LATEST_MOONRIVER_DIFF -gt 0 ] && echo "+" )${LATEST_MOONRIVER_DIFF} KB compared to latest release")) ${LATEST_MOONRIVER_STATUS}" echo "### WASM runtime size check:" > runtime_size_report.md echo "" >> runtime_size_report.md - echo "#### Compared to target branch ${MOONBASE_STATUS}" >> runtime_size_report.md + echo "#### Compared to target branch" >> runtime_size_report.md echo "" >> runtime_size_report.md echo "$MOONBASE_MSG" >> runtime_size_report.md echo "" >> runtime_size_report.md @@ -437,13 +444,14 @@ jobs: echo "" >> runtime_size_report.md echo "$MOONRIVER_MSG" >> runtime_size_report.md echo "" >> runtime_size_report.md - echo "#### Compared to latest release (${LATEST_RELEASE_TAG}) ${MOONBASE_STATUS}" >> runtime_size_report.md + echo "#### Compared to latest release (${LATEST_RELEASE_TAG})" >> runtime_size_report.md echo "" >> runtime_size_report.md echo "$LATEST_MOONBASE_MSG" >> runtime_size_report.md echo "" >> runtime_size_report.md echo "$LATEST_MOONBEAM_MSG" >> runtime_size_report.md echo "" >> runtime_size_report.md echo "$LATEST_MOONRIVER_MSG" >> runtime_size_report.md + cat runtime_size_report.md - name: Find Comment uses: peter-evans/find-comment@v3 id: fc From 22a476417be177689a7ce5ea0b9e113f90cfbcef Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Mon, 5 Aug 2024 10:51:00 -0300 Subject: [PATCH 19/21] add twiggy diff reports as artifacts --- .github/workflows/build.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52713f4e51..faa8ce93f4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -393,6 +393,26 @@ jobs: echo "LATEST_MOONBASE=$LATEST_MOONBASE" >> $GITHUB_ENV echo "LATEST_MOONBEAM=$LATEST_MOONBEAM" >> $GITHUB_ENV echo "LATEST_MOONRIVER=$LATEST_MOONRIVER" >> $GITHUB_ENV + - name: Create Twiggy diff reports + run: | + # Install Twiggy if not already installed + if ! command -v twiggy &> /dev/null; then + cargo install twiggy + fi + + # Generate Twiggy diff reports in JSON format with top 100 entries + twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonbase_runtime.wasm uncompressed-runtimes-current-branch/moonbase_runtime.wasm > twiggy_diff_moonbase.json + twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonbeam_runtime.wasm uncompressed-runtimes-current-branch/moonbeam_runtime.wasm > twiggy_diff_moonbeam.json + twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonriver_runtime.wasm uncompressed-runtimes-current-branch/moonriver_runtime.wasm > twiggy_diff_moonriver.json + + - name: Upload Twiggy diff reports + uses: actions/upload-artifact@v2 + with: + name: twiggy-diff-reports + path: | + twiggy_diff_moonbase.json + twiggy_diff_moonbeam.json + twiggy_diff_moonriver.json - name: Compare Runtimes sizes run: | # Create or truncate the file From 3d8ad7c7c8f9e81d561386447aa6b0b94ba90116 Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Mon, 5 Aug 2024 11:12:38 -0300 Subject: [PATCH 20/21] use upload v4 & create reports dir --- .github/workflows/build.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 61e407bd20..f2046df3a6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -401,18 +401,16 @@ jobs: fi # Generate Twiggy diff reports in JSON format with top 100 entries - twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonbase_runtime.wasm uncompressed-runtimes-current-branch/moonbase_runtime.wasm > twiggy_diff_moonbase.json - twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonbeam_runtime.wasm uncompressed-runtimes-current-branch/moonbeam_runtime.wasm > twiggy_diff_moonbeam.json - twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonriver_runtime.wasm uncompressed-runtimes-current-branch/moonriver_runtime.wasm > twiggy_diff_moonriver.json + mkdir -p twiggy-diff-reports + twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonbase_runtime.wasm uncompressed-runtimes-current-branch/moonbase_runtime.wasm > twiggy-diff-reports/twiggy_diff_moonbase.json + twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonbeam_runtime.wasm uncompressed-runtimes-current-branch/moonbeam_runtime.wasm > twiggy-diff-reports/twiggy_diff_moonbeam.json + twiggy diff -n 100 --format json uncompressed-runtimes-target-branch/moonriver_runtime.wasm uncompressed-runtimes-current-branch/moonriver_runtime.wasm > twiggy-diff-reports/twiggy_diff_moonriver.json - name: Upload Twiggy diff reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: twiggy-diff-reports - path: | - twiggy_diff_moonbase.json - twiggy_diff_moonbeam.json - twiggy_diff_moonriver.json + path: twiggy-diff-reports - name: Compare Runtimes sizes run: | # Create or truncate the file From 4422ea0a600b2dbdd09b07cbfe1f1c8344dfae7e Mon Sep 17 00:00:00 2001 From: Pablo Labarta Date: Tue, 6 Aug 2024 19:53:24 -0300 Subject: [PATCH 21/21] rm: deprecated ::set-output cmd --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2046df3a6..be3739ebd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -380,7 +380,6 @@ jobs: run: | LATEST_RELEASE_TAG=$(gh api repos/moonbeam-foundation/moonbeam/releases --paginate --jq '.[] | select(.tag_name | test("^runtime-\\d+$")) | .tag_name' | sort -V | tail -n 1) echo "LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG" >> $GITHUB_ENV - echo "::set-output name=LATEST_RELEASE_TAG::$LATEST_RELEASE_TAG" echo $LATEST_RELEASE_TAG - name: Download latest release runtimes run: |