Skip to content

Start rebuilding the GH actions for speed #28

Start rebuilding the GH actions for speed

Start rebuilding the GH actions for speed #28

Workflow file for this run

on:
push:
branches: [main, 'release-v**']
pull_request:
name: Build&Publish WASM
concurrency:
group: 'build-wasm-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-runtime-wasms:
strategy:
matrix:
# To test until I get one right
# target: [build-runtime, build-runtime-fast, build-runtime-testnet]
# package: [centrifuge-runtime, altair-runtime]
target: [build-runtime-fast, build-runtime-testnet]
package: [altair-runtime]
rust_version: ["1.66.0"]
exclude:
- target: "build-runtime-testnet"
package: "centrifuge-runtime"
name: ${{ matrix.target }}-${{ matrix.package }}
runs-on: ubuntu-latest-4-cores
# Cannot make sccache work with the srtool container
# env:
# SCCACHE_GHA_ENABLED: "true"
# RUSTC_WRAPPER: "sccache"
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2
- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ matrix.rust_version }}
- uses: Swatinem/rust-cache@e207df5d269b42b69c8bc5101da26f7d31feddb4 # 2.6.2
with:
prefix-key: build
shared-key: wasm
# save-if: ${{ github.ref == 'refs/heads/master' }}
# TEST 2: Sccache with Google Buckets
# FAILED: does not work inside the srtool container
# - name: SCcache setup
# uses: ./.github/actions/sccache-gcloud
# with:
# GWIP: ${{ secrets.GWIP_SCCACHE }}
# GSA: ${{ secrets.GSA_SCCACHE }}
- name: Setup build options
id: buildopt
run: |
if ${{ matrix.target == 'build-runtime-testnet'}} ; then
echo "BUILD_OPTS="--features=testnet-runtime"" >> GITHUB_ENV
elif ${{ matrix.target == 'build-runtime-fast'}} ; then
echo "BUILD_OPTS="--features=fast-runtime"" >> GITHUB_ENV
fi
- name: Run Docker SRTool
uses: addnab/docker-run-action@v3
env:
RUSTC_VERSION: ${{ matrix.rust_version }}
BUILD_OPTS: ${{ env.BUILD_OPTS }}
with:
image: paritytech/srtool:${{ matrix.rust_version }}
options: --user root -v /home/runner/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e PACKAGE=${{ matrix.package }}
run: |
echo "BUILD_OPT=${BUILD_OPT}"
echo "PACKAGE=${PACKAGE}"
echo "---- List Cache Folder ----"
ls -la /cargo-home/
du -sh /cargo-home/*
echo "---- Rust Versions ----"
rustc --version
rustup --version
cargo --version
echo "---- RUNNING BUILD ----"
/srtool/build
# - if: ${{ matrix.target }} != "build-node"
# name: Upload WASM to GHA
# uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce #@3.1.2
# with:
# name: ${{ matrix.package }}-${{ matrix.target }}-wasm
# path: ./runtime/centrifuge/target/srtool/release/wbuild/centrifuge-runtime/centrifuge_runtime.compact.compressed.wasm
# if-no-files-found: error
# publish:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# target: [build-runtime, build-runtime-fast, build-runtime-testnet]
# package: [centrifuge-runtime, altair-runtime]
# exclude:
# - target: build-runtime-testnet
# package: centrifuge-runtime
# steps:
# - name: Publish artifacts to GCS
# uses: ./centrifuge-chain/.github/actions/publish-wasm
# with:
# runtime: ${{ matrix.target }}
# package: ${{ matrix.package }}