Skip to content

Commit

Permalink
chore(ci): fix wasm-size-check
Browse files Browse the repository at this point in the history
  • Loading branch information
RomarQ committed Jan 24, 2025
1 parent 871d660 commit b0d81d0
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ jobs:
name: "Check WASM runtimes with Twiggy"
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
pull-requests: write
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork }}
Expand All @@ -317,24 +318,47 @@ jobs:
- name: Download Twiggy
run: cargo install twiggy
- name: Lookup for latest target branch build
id: latest-target-build
run: |
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
- name: "Download runtimes from target branch"
uses: actions/download-artifact@v4
with:
name: runtimes
path: runtimes-target-branch
merge-multiple: true
github-token: ${{ github.token }}
run-id: ${{ steps.latest-target-build.outputs.LATEST_TARGET_BRANCH_BUILD }}
- name: "Download uncompressed-runtimes from target branch"
uses: actions/download-artifact@v4
with:
name: uncompressed-runtimes
path: uncompressed-runtimes-target-branch
merge-multiple: true
github-token: ${{ github.token }}
run-id: ${{ steps.latest-target-build.outputs.LATEST_TARGET_BRANCH_BUILD }}
- name: Check Runtimes size for target branch
run: |
gh run -R moonbeam-foundation/moonbeam download $LATEST_TARGET_BRANCH_BUILD -n uncompressed-runtimes --dir uncompressed-runtimes-target-branch
gh run -R moonbeam-foundation/moonbeam download $LATEST_TARGET_BRANCH_BUILD -n runtimes --dir 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:
name: runtimes
path: runtimes-current-branch
merge-multiple: true
- name: "Download branch built uncompressed-runtimes"
uses: actions/download-artifact@v4
with:
name: uncompressed-runtimes
path: uncompressed-runtimes-current-branch
merge-multiple: true
- name: Check Runtimes size for current branch
run: |
CURRENT_MOONBASE=$(du -k runtimes-current-branch/* | awk '/moonbase_runtime/ {print $1}')
Expand All @@ -360,14 +384,6 @@ jobs:
echo "LATEST_MOONBASE=$LATEST_MOONBASE" >> $GITHUB_ENV
echo "LATEST_MOONBEAM=$LATEST_MOONBEAM" >> $GITHUB_ENV
echo "LATEST_MOONRIVER=$LATEST_MOONRIVER" >> $GITHUB_ENV
- 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}')
echo "PREVIOUS_MOONBASE=$PREVIOUS_MOONBASE" >> $GITHUB_ENV
echo "PREVIOUS_MOONBEAM=$PREVIOUS_MOONBEAM" >> $GITHUB_ENV
echo "PREVIOUS_MOONRIVER=$PREVIOUS_MOONRIVER" >> $GITHUB_ENV
- name: Create Twiggy diff reports
run: |
# Install Twiggy if not already installed
Expand Down

0 comments on commit b0d81d0

Please sign in to comment.