Skip to content

Release v0.13.0

Release v0.13.0 #220

Workflow file for this run

on:
push:
tags:
- '*'
pull_request:
paths:
- ".github/workflows/build-wasm.yml"
name: Build&Publish WASM
concurrency:
group: '${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
permissions:
id-token: write
contents: read
jobs:
build-runtime-wasms:
environment: production # It needs the production GCP credentials to upload WASM
# Benchmark (with cache hit)
# ubuntu-latest 50 min
# ubuntu-latest-4-cores 34 min
runs-on: ubuntu-latest-4-cores
strategy:
matrix:
chain: [ altair, centrifuge, development ]
name: build-runtime-${{ matrix.chain }}
steps:
# PREP
- name: Check out code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b #4.1.4
- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
# sccache does not work inside the srtool container
- uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # 2.7
with:
prefix-key: build
shared-key: wasm
workspaces: |
.
./target/srtool
cache-directories: ./runtime
- name: Fix permissions for Docker
run: |
chmod -R 777 ${{ github.workspace }}
# BUILD
- name: Build ${{ matrix.chain }}
id: srtool_build
uses: chevdor/srtool-actions@v0.8.0
env:
BUILD_OPTS: "--features on-chain-release-build"
RUST_BACKTRACE: 1
with:
chain: ${{ matrix.chain }}
# package: ${{ matrix.chain }}
# runtime_dir: ${{ matrix.runtime.path }}
workdir: ${{ github.workspace }}
profile: "release"
# USING DOCKER DIRECTLY
# - name: Run srtool # https://docs.substrate.io/reference/command-line-tools/srtool/
# run: >
# docker run --rm --user root --platform=linux/amd64
# -e PACKAGE=${{ matrix.chain }} -e BUILD_OPTS="--features=on-chain-release-build" -v /home/runner/.cargo:/cargo-home
# -v ${{ github.workspace }}:/build paritytech/srtool:1.77.0-0.15.0
# /srtool/build --app
# Alternative way of running SRTool that allows for "script-like" execution,
# extremely useful to debug:
# - name: Run Docker SRTool
# uses: addnab/docker-run-action@4f65fabd2431ebc8d299f8e5a018d79a769ae185 #v3
# with:
# image: paritytech/srtool:${{ matrix.rust_version }}
# options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e BUILD_OPTS=${{ env.BUILD_OPTS || ''}} -e PACKAGE=${{ matrix.chain }}
# run: |
# echo "---- Env VARS ----"
# echo "BUILD_OPT=${BUILD_OPT}"
# echo "PACKAGE=${PACKAGE}"
# echo "---- List Cache Folder ----"
# ls -la /cargo-home/
# du -sh /cargo-home/*
# echo "---- RUNNING BUILD ----"
# /srtool/build --save
- id: 'auth'
if: github.event_name != 'pull_request'
uses: 'google-github-actions/auth@5a50e581162a13f4baa8916d01180d2acbc04363' # v2.1.0
with:
workload_identity_provider: ${{ secrets.GWIP_ARTIFACTS }}
service_account: ${{ secrets.GSA_ARTIFACTS }}
- name: Setup - gcloud / gsutil
if: ${{ steps.auth.outcome == 'success' }}
uses: google-github-actions/setup-gcloud@98ddc00a17442e89a24bbf282954a3b65ce6d200 # v2.1.0
- name: Summary
run: |
echo Summary:
echo - version: ${{ steps.srtool_build.outputs.version }}
echo - info: ${{ steps.srtool_build.outputs.info }}
echo - prop: ${{ steps.srtool_build.outputs.proposal_hash }}
echo - json: ${{ steps.srtool_build.outputs.json }}
echo - runtime location: ${{ steps.srtool_build.outputs.wasm }}"
- name: Publish artifacts to GCS
if: ${{ steps.auth.outcome == 'success' }}
shell: bash
run: |
echo '${{ steps.srtool_build.outputs.json }}' | jq . > ${{ matrix.chain }}-srtool-digest.json
cat ${{ matrix.chain }}-srtool-digest.json
gsutil cp \
${{ steps.srtool_build.outputs.wasm }} \
gs://centrifuge-wasm-repo/${runtime_name}/${{ matrix.chain }}-$(git rev-parse --short HEAD).wasm
gsutil cp \
${{ matrix.chain }}-srtool-digest.json \
gs://centrifuge-wasm-repo/${runtime_name}/${{ matrix.chain }}-$(git rev-parse --short HEAD)-srtool-digest.json