-
Notifications
You must be signed in to change notification settings - Fork 122
366 lines (303 loc) · 12.1 KB
/
check.yml
File metadata and controls
366 lines (303 loc) · 12.1 KB
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
name: Check
on:
workflow_call:
env:
TERM: xterm-256color
RUST_BACKTRACE: short
RUST_LIB_BACKTRACE: 1
CARGO_TERM_COLOR: always
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_PROFILE_TEST_DEBUG: 0
CARGO_INCREMENTAL: 0
NEXTEST_PROFILE: ci
jobs:
unused-deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cargo-bins/cargo-binstall@main
- run: cargo binstall --no-confirm cargo-shear
- run: cargo shear --exclude=gear-workspace-hack
fmt:
runs-on: ubuntu-latest
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Check formatting: Gear"
run: ./scripts/gear.sh format gear --check
typos:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: typos-action
uses: crate-ci/typos@master
ethexe-contracts:
runs-on: ubuntu-latest
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
with:
submodules: recursive
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Install: rustup stable"
run: |
rustup show
rustup install stable
- name: "Install rust-script"
run: cargo install rust-script
- name: "Install: Foundry"
uses: foundry-rs/foundry-toolchain@v1
with:
version: v1.5.1
- name: "Install: Node.js"
uses: actions/setup-node@v4
with:
node-version: 22.x
- name: "Show: Versioning"
run: forge --version
- name: "Check: ethexe contracts"
run: |
npm cache clean --force
# version from ethexe/contracts/lib/openzeppelin-foundry-upgrades/src/internal/Versions.sol
npx @openzeppelin/upgrades-core@^1.37.0
forge fmt --check
forge build --sizes
forge test -vvv
working-directory: ethexe/contracts
- name: "Check: ABI files are updated"
run: |
cp ./ethexe/contracts/out/POAMiddleware.sol/POAMiddleware.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/Middleware.sol/Middleware.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/Mirror.sol/Mirror.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/MirrorWithInstrumentation.sol/MirrorWithInstrumentation.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/Router.sol/Router.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/RouterWithInstrumentation.sol/RouterWithInstrumentation.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/TransparentUpgradeableProxy.sol/TransparentUpgradeableProxy.json ./ethexe/ethereum/abi
cp ./ethexe/contracts/out/WrappedVara.sol/WrappedVara.json ./ethexe/ethereum/abi
git diff --exit-code ./ethexe/ethereum/abi/*.json || (echo "Some abi files have been modified. Please commit the changes." && exit 1)
- name: "Check: Clones.sol is updated"
run: |
../scripts/update-clones-sol.rs \
--mirror-proxy out/MirrorProxy.sol/MirrorProxy.json \
--clones src/libraries/Clones.sol
forge fmt
git diff --exit-code src/libraries/Clones.sol || (echo "Clones.sol has been modified. Please commit the changes." && exit 1)
working-directory: ethexe/contracts
clippy:
strategy:
fail-fast: false
matrix:
include:
- name: macos-aarch64
target: aarch64-apple-darwin
runs-on: macos-latest
- name: macos-x86_64
target: x86_64-apple-darwin
runs-on: macos-latest
- name: linux-x86_64
target: x86_64-unknown-linux-gnu
runs-on: ubuntu-24.04-arm
- name: linux-aarch64
target: aarch64-unknown-linux-gnu
runs-on: ubuntu-24.04-arm
- name: windows-x86_64
target: x86_64-pc-windows-msvc
runs-on: ubuntu-24.04-arm
runs-on: ${{ matrix.runs-on }}
name: clippy (${{ matrix.name }})
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
with:
submodules: recursive
- name: "Install: Setup linker"
uses: ./.github/actions/setup-linker
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Install: Compilation environment"
uses: ./.github/actions/setup-compilation-env
with:
target: "${{ matrix.target }}"
- name: "ACTIONS: Setup caching"
uses: ./.github/actions/rust-cache
with:
eu-access-key-id: "${{ secrets.GEAR_CI_S3_EU_ACCESS_KEY_ID }}"
eu-secret-access-key: "${{ secrets.GEAR_CI_S3_EU_SECRET_ACCESS_KEY }}"
key: "${{ matrix.name }}"
- name: "Check clippy"
run: ./scripts/gear.sh clippy gear --all-targets --all-features --locked
workspace-hack:
runs-on: ubuntu-latest
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
with:
submodules: recursive
- name: "Install: Setup linker"
uses: ./.github/actions/setup-linker
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Install: Rust stable toolchain"
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
- name: "Install: Compilation environment"
uses: ./.github/actions/setup-compilation-env
with:
target: x86_64-unknown-linux-gnu
- name: "Check if workspace hack Cargo.toml is up-to-date"
run: |
cargo hakari generate && ./scripts/hakari-post-process.sh
git diff --exit-code utils/gear-workspace-hack/Cargo.toml || {
echo "::error::workspace hack Cargo.toml is out of date. Run 'make workspace-hack' and commit the result."
exit 1
}
- name: "Check if all workspace crates depend on workspace hack"
uses: ./.github/actions/cargo-hakari
with:
args: manage-deps --dry-run
- name: "ACTIONS: Setup caching"
uses: ./.github/actions/rust-cache
with:
eu-access-key-id: "${{ secrets.GEAR_CI_S3_EU_ACCESS_KEY_ID }}"
eu-secret-access-key: "${{ secrets.GEAR_CI_S3_EU_SECRET_ACCESS_KEY }}"
# we want to test the hack that doesn't interfere with some Substrate features
keep-workspace-hack: true
- name: "Check clippy with workspace hack enabled"
run: ./scripts/gear.sh clippy gear --all-targets --all-features --locked
- name: "Check `try-runtime` and `benchmarks` features aren't required for node"
run: __GEAR_WASM_BUILDER_NO_BUILD=1 SKIP_WASM_BUILD=1 cargo clippy -p gear-cli
wasm:
runs-on: ubuntu-latest
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Setup linker"
uses: ./.github/actions/setup-linker
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Install: Rust stable toolchain"
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
- name: "ACTIONS: Setup caching"
uses: ./.github/actions/rust-cache
with:
eu-access-key-id: "${{ secrets.GEAR_CI_S3_EU_ACCESS_KEY_ID }}"
eu-secret-access-key: "${{ secrets.GEAR_CI_S3_EU_SECRET_ACCESS_KEY }}"
- name: "Check: Wasm-builder recommended toolchain matches rust-toolchain.toml"
run: |
TOOLCHAIN=$(grep 'channel' rust-toolchain.toml | cut -d '"' -f 2)
CARGO_TOOLCHAIN="utils/wasm-optimizer/src/cargo_toolchain.rs"
if ! grep -q "$TOOLCHAIN" $CARGO_TOOLCHAIN; then
echo "Please update PINNED_NIGHTLY_TOOLCHAIN constant in $CARGO_TOOLCHAIN to match rust-toolchain.toml."
exit 1
fi
- name: "Check clippy: Examples"
run: ./scripts/gear.sh clippy examples --all-targets --locked
- name: "Check clippy: no_std crates"
run: ./scripts/gear.sh clippy no_std --locked
- run: cargo +stable check -p gstd --target wasm32v1-none
- run: cargo +stable check --manifest-path utils/wasm-builder/test-program/Cargo.toml
- run: cargo +stable check --manifest-path utils/cargo-gbuild/test-program/Cargo.toml --workspace --target wasm32v1-none
vara-runtime-imports:
runs-on: ubuntu-latest
needs: [clippy, wasm]
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Setup linker"
uses: ./.github/actions/setup-linker
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Install: Compilation environment"
uses: ./.github/actions/setup-compilation-env
with:
target: x86_64-unknown-linux-gnu
- name: "ACTIONS: Setup caching"
uses: ./.github/actions/rust-cache
with:
eu-access-key-id: "${{ secrets.GEAR_CI_S3_EU_ACCESS_KEY_ID }}"
eu-secret-access-key: "${{ secrets.GEAR_CI_S3_EU_SECRET_ACCESS_KEY }}"
key: "${{ matrix.name }}"
- name: "Build: Vara runtime and wasm-proc"
run: cargo build -p vara-runtime -p wasm-proc --release
- name: "Check: Vara runtime imports"
run: >-
./target/x86_64-unknown-linux-gnu/release/wasm-proc
--check-runtime-imports
target/x86_64-unknown-linux-gnu/release/wbuild/vara-runtime/vara_runtime.compact.wasm
stack-height:
strategy:
fail-fast: false
matrix:
include:
- name: macos-aarch64
target: aarch64-apple-darwin
runs-on: macos-latest
- name: macos-x86_64
target: x86_64-apple-darwin
runs-on: macos-15-intel
- name: linux-x86_64
target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
- name: linux-aarch64
target: aarch64-unknown-linux-gnu
runs-on: ubuntu-24.04-arm
- name: windows-x86_64
target: x86_64-pc-windows-msvc
runs-on: windows-latest
runs-on: ${{ matrix.runs-on }}
needs: [clippy, wasm]
name: stack-height (${{ matrix.name }})
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Setup linker"
if: matrix.name != 'macos-x86_64'
uses: ./.github/actions/setup-linker
- name: "Install: Rust toolchain"
if: matrix.name != 'macos-x86_64'
uses: ./.github/actions/install-rust
- name: "ACTIONS: Setup caching"
if: matrix.name != 'macos-x86_64'
uses: ./.github/actions/rust-cache
with:
eu-access-key-id: "${{ secrets.GEAR_CI_S3_EU_ACCESS_KEY_ID }}"
eu-secret-access-key: "${{ secrets.GEAR_CI_S3_EU_SECRET_ACCESS_KEY }}"
key: "${{ matrix.name }}"
- name: "Run: Calculate stack height"
if: matrix.name != 'macos-x86_64'
run: cargo run -p calc-stack-height --release --locked
gsdk-metadata:
runs-on: ubuntu-latest
needs: [clippy, wasm]
steps:
- name: "ACTIONS: Checkout"
uses: actions/checkout@v4
- name: "Install: Setup linker"
uses: ./.github/actions/setup-linker
- name: "Install: Rust toolchain"
uses: ./.github/actions/install-rust
- name: "Install: Compilation environment"
uses: ./.github/actions/setup-compilation-env
with:
target: x86_64-unknown-linux-gnu
- name: "ACTIONS: Setup caching"
uses: ./.github/actions/rust-cache
with:
eu-access-key-id: "${{ secrets.GEAR_CI_S3_EU_ACCESS_KEY_ID }}"
eu-secret-access-key: "${{ secrets.GEAR_CI_S3_EU_SECRET_ACCESS_KEY }}"
- name: "Check: Changes in vara_runtime.scale file"
run: |
SCALE_FILE="gsdk/vara_runtime.scale"
./scripts/update-gsdk-metadata.sh
if [[ $(git diff --stat $SCALE_FILE) != '' ]]; then
echo "Changes found in the SCALE metadata ($SCALE_FILE). Please update it following the instructions in \`gsdk/HOW-TO-UPDATE.md\`."
exit 1
fi