Skip to content

Manual Build - Fellowship #21

Manual Build - Fellowship

Manual Build - Fellowship #21

name: Manual Build - Fellowship
env:
SUBWASM_VERSION: 0.20.0
on:
workflow_dispatch:
inputs:
image:
description: The SRTOOL image to use use
default: paritytech/srtool
srtool_tag:
description: The SRTOOL tag to use
default: 1.70.0
required: false
ref:
description: The ref to be used for the repo
default: main
required: false
cache:
description: By default, caching will be used but you can turn it off here if you provide 'false'
default: true
schedule:
- cron: "00 04 * * 1"
jobs:
build:
name: Build ${{ matrix.chain }} ${{ github.event.inputs.ref }}
strategy:
fail-fast: false
matrix:
include:
# Relay
- runtime_dir: relay/kusama
runtime: staging-kusama-runtime
chain: staging-kusama
- runtime_dir: relay/polkadot
runtime: polkadot-runtime
chain: polkadot
# System parachains / Asset Hub
- runtime_dir: system-parachains/asset-hubs/asset-hub-kusama
runtime: asset-hub-kusama-runtime
chain: asset-hub-kusama
- runtime_dir: system-parachains/asset-hubs/asset-hub-polkadot
runtime: asset-hub-polkadot-runtime
chain: asset-hub-polkadot
# System parachains / Bridge Hub
- runtime_dir: system-parachains/bridge-hubs/bridge-hub-kusama
runtime: bridge-hub-kusama-runtime
chain: bridge-hub-kusama
- runtime_dir: system-parachains/bridge-hubs/bridge-hub-polkadot
runtime: bridge-hub-polkadot-runtime
chain: bridge-hub-polkadot
# System parachains / Collectives
- runtime_dir: system-parachains/collectives/collectives-polkadot
runtime: collectives-polkadot-runtime
chain: collectives-polkadot
runs-on: ubuntu-latest
steps:
- name: Cache ${{ matrix.chain }} runtime for ${{ github.sha }}
id: cache_runtime
if: github.event.inputs.cache == 'true'
uses: actions/cache@v3
with:
key: ${{ matrix.chain }}-${{ github.sha }}
path: |
sdk/${{ matrix.runtime_dir }}/target/srtool/release/wbuild/${{ matrix.chain }}-runtime
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
if: ${{ steps.cache_runtime.outputs.cache-hit != 'true' }}
with:
repository: polkadot-fellows/runtimes
ref: ${{ github.event.inputs.ref }}
fetch-depth: 0
- name: Srtool build
id: srtool_build
if: ${{ steps.cache_runtime.outputs.cache-hit != 'true' }}
uses: chevdor/[email protected]
with:
chain: ${{ matrix.chain }}
runtime_dir: ${{ matrix.runtime_dir }}
image: ${{ github.event.inputs.image }}
tag: ${{ github.event.inputs.srtool_tag }}
# This is done to allow caching
- name: Store build artifacts to disk
id: cache_digest
if: ${{ steps.cache_runtime.outputs.cache-hit != 'true' }}
run: |
cached_output=${{ matrix.runtime_dir }}/target/srtool/release/wbuild/${{ matrix.chain }}-runtime/
digest_file=${cached_output}/${{ matrix.chain }}-srtool-digest.json
echo '${{ steps.srtool_build.outputs.json }}' | jq > ${digest_file}
cat ${digest_file}
echo "digest_file=$digest_file" >> "$GITHUB_OUTPUT"
- name: Retrieve WASM paths
id: get_values
run: |
runtime_package=${{ matrix.chain }}-runtime
runtime_filename=${runtime_package//-/_}
wasm="${{ matrix.runtime_dir }}/target/srtool/release/wbuild/${runtime_package}/${runtime_filename}.compact.wasm"
wasm_compressed="${{ matrix.runtime_dir }}/target/srtool/release/wbuild/${runtime_package}/${runtime_filename}.compact.compressed.wasm"
# we need wasm and wasm_compressed
echo "wasm=$wasm" >> "$GITHUB_OUTPUT"
echo "wasm_compressed=$wasm_compressed" >> "$GITHUB_OUTPUT"
- name: Summary
run: |
cached_output=${{ matrix.runtime_dir }}/target/srtool/release/wbuild/${{ matrix.chain }}-runtime/
digest_file=${cached_output}/${{ matrix.chain }}-srtool-digest.json
ls -al ${digest_file}
cat ${digest_file}
echo "WASM location: ${{ steps.get_values.outputs.wasm }}"
echo "WASM Compressed location: ${{ steps.get_values.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@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with:
name: ${{ matrix.chain }}-runtime
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 ${{ 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: 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
- 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