BIT-353: Update brew install deps #18
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]+' | |
## | |
# 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: | | |
brew upgrade && | |
yes | brew install git cmake openssl protobuf | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1.0.6 | |
with: | |
toolchain: ${{ matrix.rust-toolchain }} | |
target: ${{ matrix.rust-target }} | |
override: true | |
profile: minimal | |
- name: Set up cargo 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') }} | |
restore-keys: ${{ matrix.rust-target }}-cargo- | |
- name: Run tests | |
run: | | |
cargo test --tests | |
- name: Build executable | |
run: | | |
cargo build --release | |
- name: Srtool build | |
id: srtool_build | |
uses: chevdor/srtool-actions@v0.7.0 | |
env: | |
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }} | |
TARGET: ${{ matrix.rust-target }} | |
BUILD_OPTS: "+nightly" | |
with: | |
chain: ${{ matrix.chain }} | |
runtime_dir: runtime | |
- name: 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/release-action@v1.12.0 | |
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 }}' | |