BIT-353: BIT-353 adding custom image to run srtool #60
Workflow file for this run
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: Build wasm, chainspec and publish release | |
concurrency: | |
group: ci-${{ github.ref }} | |
cancel-in-progress: true | |
## | |
on: | |
## | |
# Run when a semantic version is tagged | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
## | |
# Alternatives triggers | |
branches: | |
- "BIT-353-create-deterministic-wasm-builds-on-github-tag" | |
workflow_dispatch: | |
## | |
# Environment variables shared for all targets | |
env: | |
CARGO_TERM_COLOR: always | |
RELEASE: true | |
RELEASE_NAME: release | |
RUSTFLAGS: -A warnings | |
RUST_BACKTRACE: full | |
SKIP_WASM_BUILD: 1 | |
VERBOSE: ${{ github.events.input.verbose }} | |
## | |
# Test and build and publish | |
jobs: | |
check: | |
name: Testing, building and publishing for ${{ matrix.rust-target }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
## | |
# Define multiple targets for builds and tests | |
strategy: | |
matrix: | |
chain: | |
- node-subtensor | |
rust-toolchain: | |
- nightly-2023-03-01 | |
rust-target: | |
- wasm32-unknown-unknown | |
os: | |
- self-hosted | |
## | |
# Environment variables specific to each target | |
env: | |
RUST_BIN_DIR: target/${{ matrix.rust-target }}/release | |
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }} | |
TARGET: ${{ matrix.rust-target }} | |
## | |
steps: | |
- name: Check-out repository under ${{ github.workspace }} | |
uses: actions/checkout@v2 | |
- name: 🔧 Install dependencies | |
run: | | |
./scripts/install-deps.sh | |
- name: 🔧 Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust-toolchain }} | |
target: ${{ matrix.rust-target }} | |
override: true | |
profile: minimal | |
#- name: ⚡ Cache | |
# uses: actions/cache@v3 | |
# continue-on-error: false | |
# with: | |
# path: | | |
# ~/.cargo/bin/ | |
# ~/.cargo/registry/index/ | |
# ~/.cargo/registry/cache/ | |
# ~/.cargo/git/db/ | |
# target/ | |
# key: ${{ matrix.rust-target }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: ⚡ Cache dependencies | |
uses: Swatinem/[email protected] | |
- name: ⚡ Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
#- name: 🔎 Test | |
# run: | | |
# cargo test --tests --profile ci-test | |
#- name: 🚀 Build executable | |
# run: | | |
# cargo build --profile ci-release | |
- name: Srtool build | |
id: srtool_build | |
uses: chevdor/[email protected] | |
env: | |
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }} | |
TARGET: ${{ matrix.rust-target }} | |
#BUILD_OPTS: "" | |
with: | |
chain: ${{ matrix.chain }} | |
image: paritytech/srtool | |
tag: 1.69.0 | |
runtime_dir: runtime | |
package: node-subtensor-runtime | |
profile: ci-release | |
- name: Srtool 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 }}" | |
- name: Create chainspec | |
run: | | |
target/${{ matrix.rust-target }}/release/node-subtensor build-spec --disable-default-bootnode --raw --chain finney > release_chainspec.json | |
## TODO: double-check `artifacts` path(s) be correct | |
# :warning: values for the following must always match; | |
# - RUST_BIN_DIR | |
# - target/${{ matrix.rust-target }}/release/node-subtensor | |
- name: Create Release | |
uses: ncipollo/[email protected] | |
with: | |
allowUpdates: false | |
artifactErrorsFailBuild: true | |
bodyFile: CHANGELOG.md | |
makeLatest: true | |
tag: ${{ github.ref }}-${{ matrix.rust-target }} | |
name: Release ${{ github.ref }} for ${{ matrix.rust-target }} | |
artifacts: 'release_chainspec.json,target/${{ matrix.rust-target }}/release/node-subtensor,${{ steps.srtool_build.outputs.wasm_compressed }}' |