From 462c61a95012e26a248075d34a2d7f33ec403c54 Mon Sep 17 00:00:00 2001 From: Chevdor Date: Wed, 23 Aug 2023 17:28:31 +0200 Subject: [PATCH] Add moonbeam/moonriver for testing (#19) * Add moonbeam/moonriver for testing * Prevent CI to start twice when pushing to a PR branch * Fix checkout path * Fix checkout path --- .github/workflows/cumulus.yml | 8 ++--- .github/workflows/moonbeam.yml | 66 ++++++++++++++++++++++++++++++++-- .github/workflows/polkadot.yml | 8 ++--- action.yml | 4 +-- 4 files changed, 74 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cumulus.yml b/.github/workflows/cumulus.yml index 643abac..a3a82d3 100644 --- a/.github/workflows/cumulus.yml +++ b/.github/workflows/cumulus.yml @@ -5,13 +5,13 @@ env: on: pull_request: - branches: - - master + types: [opened, reopened, synchronize] + push: - branches: - - "*" tags: - "v*" + branches: + - master workflow_dispatch: inputs: diff --git a/.github/workflows/moonbeam.yml b/.github/workflows/moonbeam.yml index 78c9d14..bdcf9c1 100644 --- a/.github/workflows/moonbeam.yml +++ b/.github/workflows/moonbeam.yml @@ -1,4 +1,3 @@ -# placeholder to be able to trigger the new workflow name: Manual Build - Moonbeam env: @@ -26,8 +25,71 @@ jobs: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 + with: + path: action + - uses: actions/checkout@v3 with: repository: PureStake/moonbeam - ref: ${{ github.event.inputs.ref }} fetch-depth: 0 + path: repo + ref: ${{ github.event.inputs.ref }} + + # We now get extra information thanks to subwasm, + - name: Install subwasm ${{ env.SUBWASM_VERSION }} + run: | + wget https://github.com/chevdor/subwasm/releases/download/v${{ env.SUBWASM_VERSION }}/subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb + sudo dpkg -i subwasm_linux_amd64_v${{ env.SUBWASM_VERSION }}.deb + subwasm --version + + - name: Srtool build + id: srtool_build + uses: ./action + with: + tag: ${{ github.event.inputs.srtool_tag }} + chain: ${{ matrix.chain }} + workdir: "${{ github.workspace }}/repo" + + - name: Summary + run: | + echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.chain }}-srtool-digest.json + cat ${{ matrix.chain }}-srtool-digest.json + echo "Runtime location: ${{ steps.srtool_build.outputs.wasm }}" + + # it takes a while to build the runtime, so let's save the artifact as soon as we have it + - name: Archive Artifacts for ${{ matrix.chain }} + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.chain }}-runtime + path: | + ${{ steps.srtool_build.outputs.wasm }} + ${{ steps.srtool_build.outputs.wasm_compressed }} + ${{ matrix.chain }}-srtool-digest.json + + - name: Show Runtime information + run: | + subwasm info ${{ steps.srtool_build.outputs.wasm }} + subwasm info ${{ steps.srtool_build.outputs.wasm_compressed }} + subwasm --json info ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-info.json + subwasm --json info ${{ steps.srtool_build.outputs.wasm_compressed }} > ${{ matrix.chain }}-info_compressed.json + + - name: Extract the metadata + run: | + subwasm meta ${{ steps.srtool_build.outputs.wasm }} + subwasm --json meta ${{ steps.srtool_build.outputs.wasm }} > ${{ matrix.chain }}-metadata.json + + - name: Check the metadata diff + run: | + # subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ matrix.chain }} | tee ${{ matrix.chain }}-diff.txt + echo "No live chain to compare" > ${{ matrix.chain }}-diff.txt + + - name: Archive Subwasm results + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: ${{ matrix.chain }}-runtime + path: | + ${{ matrix.chain }}-info.json + ${{ matrix.chain }}-info_compressed.json + ${{ matrix.chain }}-metadata.json + ${{ matrix.chain }}-diff.txt diff --git a/.github/workflows/polkadot.yml b/.github/workflows/polkadot.yml index 71d32aa..2fcf4f5 100644 --- a/.github/workflows/polkadot.yml +++ b/.github/workflows/polkadot.yml @@ -5,13 +5,13 @@ env: on: pull_request: - branches: - - master + types: [opened, reopened, synchronize] + push: - branches: - - "*" tags: - "v*" + branches: + - master workflow_dispatch: inputs: diff --git a/action.yml b/action.yml index 09daa65..6768bd9 100644 --- a/action.yml +++ b/action.yml @@ -33,8 +33,8 @@ inputs: workdir: description: > Path of the project, this is where your main Cargo.toml is located. This is relative to $GITHUB_WORKSPACE. - - required: true + default: "." + required: false runtime_dir: description: >