-
Notifications
You must be signed in to change notification settings - Fork 538
243 lines (208 loc) · 8.62 KB
/
default.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Avail CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
env:
BUILD_TOOLCHAIN: nightly-2022-11-15
CARGO_SCCACHE_COMMIT: bed5571c
SCCACHE_DIR: /home/runner/.cache/cargo-sccache-bed5571c
SCCACHE_BIN: /home/runner/.cache/cargo-sccache-bed5571c/bin/sccache
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install nightly ${{ env.BUILD_TOOLCHAIN }}
uses: actions-rs/toolchain@v1
with:
# NOTE: Until https://github.com/actions-rs/toolchain/pull/209 is merged,
# this should be synced with rust-toolchain.toml file.
# After merge, this section should be removed.
# toolchain: nightly-2022-11-25
toolchain: ${{ env.BUILD_TOOLCHAIN }}
components: rustfmt
profile: minimal
- name: Check Avail code formatting
uses: actions-rs/cargo@v1
with:
toolchain: ${{ env.BUILD_TOOLCHAIN }}
command: fmt
args: --check
- name: Check Avail-SubXt code formatting
uses: actions-rs/cargo@v1
with:
toolchain: ${{ env.BUILD_TOOLCHAIN }}
command: fmt
args: --manifest-path avail-subxt/Cargo.toml --check
build:
runs-on: ubuntu-latest
needs: [lint]
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v3
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup default ${{ env.BUILD_TOOLCHAIN }}
rustup target add wasm32-unknown-unknown --toolchain ${{ env.BUILD_TOOLCHAIN }}
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
if [ ! -f $SCCACHE_BIN ]; then
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_DIR
fi
ls -la $SCCACHE_BIN
ps aux | grep sccache
if [[ -z `pgrep sccache` ]]; then
chmod +x $SCCACHE_BIN
$SCCACHE_BIN --start-server
fi
$SCCACHE_BIN -s
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV
- name: Build node
run: cargo build --release -p data-avail
- name: Upload data-avail binary
uses: actions/upload-artifact@v2
with:
name: data-avail
path: target/release/data-avail
- name: Display SCCache Stats
run: ${{ env.SCCACHE_BIN }} --show-stats
- name: Check other features
run: cargo check --release --workspace --features "runtime-benchmarks try-runtime" -p data-avail
unit_tests:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Install build-essential
run: |
sudo apt update
sudo apt install -y build-essential
sudo apt install -y git clang curl libssl-dev protobuf-compiler
# Restore cache from `build`
- uses: actions/cache/restore@v3
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup default ${{ env.BUILD_TOOLCHAIN }}
rustup target add wasm32-unknown-unknown --toolchain ${{ env.BUILD_TOOLCHAIN }}
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
if [ ! -f $SCCACHE_BIN ]; then
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_DIR
fi
ls -la $SCCACHE_BIN
ps aux | grep sccache
if [[ -z `pgrep sccache` ]]; then
chmod +x $SCCACHE_BIN
$SCCACHE_BIN --start-server
fi
$SCCACHE_BIN -s
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV
- name: Run tests
run: |
env
cargo test --release --workspace
cargo test --release --manifest-path avail-subxt/Cargo.toml
env:
RUSTFLAGS: "-C instrument-coverage"
LLVM_PROFILE_FILE: "profile-%p-%m.profraw"
- name: Display SCCache Stats
run: ${{ env.SCCACHE_BIN }} --show-stats
- name: Generate test code coverage report
run: |
df -h
cargo +stable install --force grcov
grcov . -s . --binary-path ./target/release/ -t lcov --branch --ignore-not-existing -o lcov.info
- name: Upload test code coverage report to codecov.io
uses: codecov/codecov-action@v2
with:
files: lcov.info
- name: Cleanup
run: find . -name \*.profraw -type f -exec rm -f {} +
e2e_tests:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2
# Restore cache from `build`
- uses: actions/cache/restore@v3
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.OS }}-sccache-bin-${{ env.CARGO_SCCACHE_COMMIT }}-v1
# With rustup's nice new toml format, we just need to run rustup show to install the toolchain
# https://github.com/actions-rs/toolchain/issues/126#issuecomment-782989659
- name: Setup Rust toolchain
run: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source "$HOME/.cargo/env"
rustup default ${{ env.BUILD_TOOLCHAIN }}
rustup target add wasm32-unknown-unknown --toolchain ${{ env.BUILD_TOOLCHAIN }}
- name: SCCache
run: |
# We altered the path to avoid old actions to overwrite it
# SCCACHE_DIR=${{ runner.tool_cache }}/cargo-sccache-${CARGO_SCCACHE_COMMIT}
# SCCACHE_BIN=${SCCACHE_DIR}/bin/sccache
if [ ! -f $SCCACHE_BIN ]; then
cargo install sccache --git https://github.com/purestake/sccache.git --rev $CARGO_SCCACHE_COMMIT --force --no-default-features --features=dist-client --root $SCCACHE_DIR
fi
ls -la $SCCACHE_BIN
ps aux | grep sccache
if [[ -z `pgrep sccache` ]]; then
chmod +x $SCCACHE_BIN
$SCCACHE_BIN --start-server
fi
$SCCACHE_BIN -s
echo "RUSTC_WRAPPER=$SCCACHE_BIN" >> $GITHUB_ENV
- uses: actions/download-artifact@v2
with:
name: data-avail
- name: Run E2E SubXt tests
run: |
chmod uog+x data-avail
./data-avail --dev --tmp &
sleep 5
cargo run --release --manifest-path avail-subxt/Cargo.toml --example accounts_from_mnemonics
cargo run --release --manifest-path avail-subxt/Cargo.toml --example da_bridge_actor
cargo run --release --manifest-path avail-subxt/Cargo.toml --example headers
cargo run --release --manifest-path avail-subxt/Cargo.toml --example max_block_submit
cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_data
cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_data_and_dispatch_data_root
cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_block_length_proposal
# Democracy calls are executable only with fast runtime (with democracy InstantAllowed set to true)
# cargo run --release --manifest-path avail-subxt/Cargo.toml --example democracy_external
# cargo run --release --manifest-path avail-subxt/Cargo.toml --example submit_block_length_proposal_democracy
- name: Display SCCache Stats
run: ${{ env.SCCACHE_BIN }} --show-stats