Skip to content

Build Deterministic Runtimes #20

Build Deterministic Runtimes

Build Deterministic Runtimes #20

name: Build Deterministic Runtimes
on:
release:
types: [published]
workflow_dispatch:
jobs:
srtool:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
runtime:
- name: "paseo"
path: "relay/paseo"
- name: "asset-hub-paseo"
path: "system-parachains/asset-hub-paseo-runtime"
- name: "bridge-hub-paseo"
path: "system-parachains/bp-bridge-hub-paseo"
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache runtime target dir
uses: actions/cache@v3
with:
path: "${{ github.workspace }}/runtime/${{ matrix.runtime.name }}/target"
key: srtool-target-${{ matrix.runtime.name }}-${{ github.sha }}
restore-keys: |
srtool-target-${{ matrix.runtime.name }}-
srtool-target-
- name: Build ${{ matrix.runtime.name }} runtime
id: srtool_build
uses: chevdor/[email protected]
env:
BUILD_OPTS: "--features on-chain-release-build"
with:
chain: ${{ matrix.runtime.name }}
package: "${{ matrix.runtime.name }}-runtime"
runtime_dir: ${{ matrix.runtime.path }}
profile: "production"
- name: Store srtool digest to disk
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.runtime.name }}-srtool-digest.json
# Manual trigger: add artifacts to run
- name: Copy artifacts
if: github.event_name != 'release'
run: cp `dirname ${{ steps.srtool_build.outputs.wasm }}`/*.wasm ./
- name: Archive Runtime
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.runtime.name }}-runtime-${{ github.sha }}
path: |
${{ matrix.runtime.name }}*.wasm
${{ matrix.runtime.name }}-srtool-digest.json
# Release published: add artifacts to release
- name: Add artifacts to release
if: github.event_name == 'release'
uses: softprops/action-gh-release@v1
with:
append_body: true
body: |
## Runtime: `${{ matrix.runtime.name }}`
```
🏋️ Runtime Size: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.size }} bytes
🔥 Core Version: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.core_version.specName }}-${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.core_version.specVersion }}
🎁 Metadata version: V${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.metadata_version }}
🗳️ system.setCode hash: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.proposal_hash }}
🗳️ authorizeUpgrade hash: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.parachain_authorize_upgrade_hash }}
🗳️ Blake2-256 hash: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.blake2_256 }}
📦 IPFS: ${{ fromJSON(steps.srtool_build.outputs.json).runtimes.compressed.subwasm.ipfs_hash }}
```
files: |
${{ steps.srtool_build.outputs.wasm_compressed }}
${{ matrix.runtime.name }}-srtool-digest.json