Skip to content

Start rebuilding the GH actions for speed #17

Start rebuilding the GH actions for speed

Start rebuilding the GH actions for speed #17

Workflow file for this run

on:
push:
branches: [main, 'release-v**']
pull_request:
name: Build and publish WASMs
concurrency:
group: 'build-wasm-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-node:
name: ci-build-node
runs-on: ubuntu-latest-4-cores
env:
RUST_TOOLCHAIN: "nightly-2022-11-14"
RUSTFLAGS: " -W unused-extern-crates"
PACKAGE: "altair-runtime"
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2
# TEST 1: run sccache vanilla using the developer's action
- name: Setup sccache
uses: mozilla-actions/[email protected]
- name: Run sccache stat for check
shell: bash
run: sccache --show-stats
- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ env. RUST_TOOLCHAIN }}
- name: Reset cache (main branch only)
if: ${{ github.ref == 'refs/heads/main' }}
run: echo "SCCACHE_RECACHE=true" >> $GITHUB_ENV
- name: Check cargo build release
run: cargo build --release "$@"
- name: Run sccache stat for check
shell: bash
run: ${SCCACHE_PATH} --show-stats
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]
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
env:
# SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
permissions:
contents: 'read'
id-token: 'write' # needed for gcloud login
steps:
- name: Check out code
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab #3.5.2
# TEST 2: Sccache with Google Buckets
- name: SCcache setup
uses: ./.github/actions/sccache-gcloud
with:
GWIP: ${{ secrets.GWIP_SCCACHE }}
GSA: ${{ secrets.GSA_SCCACHE }}
- name: Run sccache stat for check
shell: bash
run: ${SCCACHE_PATH} --show-stats
- name: Prep build on Ubuntu
uses: ./.github/actions/prep-ubuntu
with:
RUST_TOOLCHAIN: ${{ matrix.rust_version }}
- name: Run Docker SRTool
uses: addnab/docker-run-action@v3
with:
image: paritytech/srtool:${{ matrix.rust_version }}
options: --user root -v ${{ env.SCCACHE_PATH }}:/usr/local/bin/sccache -v ~/.cargo:/cargo-home -v ${{ github.workspace }}:/build -e PACKAGE=${{ matrix.package }}
run: |
# apt-get update && apt-get install --yes libpq-dev wget
# wget https://github.com/mozilla/sccache/releases/download/v0.5.4/sccache-dist-v0.5.4-x86_64-unknown-linux-musl.tar.gz \
# && tar xzf sccache-dist-v0.5.4-x86_64-unknown-linux-musl.tar.gz \
# && mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache /usr/local/bin/sccache \
# && chmod +x /usr/local/bin/sccache
/srtool/build
- name: Run sccache stat for check
shell: bash
run: ${SCCACHE_PATH} --show-stats
# - 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 }}