Minor fixes and rename #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Srtool check build | ||
env: | ||
SUBWASM_VERSION: 0.20.0 | ||
on: | ||
push: | ||
tags: | ||
- "*" | ||
paths: | ||
- polkadot/runtimes/**/* | ||
- cumulus/parachains/runtimes/**/* | ||
branches: | ||
- "release*" | ||
schedule: | ||
- cron: "00 03 * * 2" # 3AM weekly on Tuesdays | ||
workflow_dispatch: | ||
jobs: | ||
find-runtimes: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
runtime: ${{ steps.scan-runtimes.outputs.runtime }} | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
- name: Install tooling | ||
run: | | ||
TOML_CLI_VERSION=0.2.4 | ||
URL=https://github.com/chevdor/toml-cli/releases/download/v${TOML_CLI_VERSION}/toml_linux_amd64_v${TOML_CLI_VERSION}.deb | ||
curl -L $URL --output toml.deb | ||
sudo dpkg -i toml.deb | ||
toml --version | ||
jq --version | ||
- name: Scan runtimes | ||
id: scan-runtimes | ||
run: | | ||
. ./.github/scripts/common/lib.sh | ||
MATRIX=$(find_runtimes) | ||
echo $MATRIX | ||
echo "runtime=$MATRIX" >> $GITHUB_OUTPUT | ||
srtool: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- find-runtimes | ||
strategy: | ||
fail-fast: false | ||
matrix: ${{ fromJSON(needs.find-runtimes.outputs.runtime) }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Srtool build | ||
id: srtool_build | ||
uses: chevdor/[email protected] | ||
with: | ||
chain: ${{ matrix.chain }} | ||
runtime_dir: ${{ matrix.runtime_dir }} | ||
- name: Summary | ||
run: | | ||
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${{ matrix.chain }}-srtool-digest.json | ||
cat ${{ matrix.chain }}-srtool-digest.json | ||
echo "Compact Runtime: ${{ steps.srtool_build.outputs.wasm }}" | ||
echo "Compressed Runtime: ${{ steps.srtool_build.outputs.wasm_compressed }}" | ||
# 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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: ${{ matrix.chain }} | ||
path: | | ||
${{ steps.srtool_build.outputs.wasm }} | ||
${{ steps.srtool_build.outputs.wasm_compressed }} | ||
${{ matrix.chain }}-srtool-digest.json | ||
# We now get extra information thanks to subwasm | ||
- name: Install subwasm | ||
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: Show Runtime information | ||
shell: bash | ||
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 }}-compressed-info.json | ||
- name: Extract the metadata | ||
shell: bash | ||
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 | ||
shell: bash | ||
# the following subwasm call will error for chains that are not known and/or live, that includes shell for instance | ||
run: | | ||
subwasm diff ${{ steps.srtool_build.outputs.wasm }} --chain-b ${{ matrix.chain }} || \ | ||
echo "Subwasm call failed, check the logs. This is likely because ${{ matrix.chain }} is not known by subwasm" | \ | ||
tee ${{ matrix.chain }}-diff.txt | ||
- name: Archive Subwasm results | ||
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2 | ||
with: | ||
name: ${{ matrix.chain }}-runtime | ||
path: | | ||
${{ matrix.chain }}-info.json | ||
${{ matrix.chain }}-compressed-info.json | ||
${{ matrix.chain }}-metadata.json | ||
${{ matrix.chain }}-diff.txt |