-
Notifications
You must be signed in to change notification settings - Fork 86
124 lines (109 loc) · 4.25 KB
/
build-wasm.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
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: Run sccache-cache
uses: mozilla-actions/[email protected]
- 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 /tmp/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-v0.2.15-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 }}