Repository navigation
47 lines (39 loc) · 1.4 KB
/
Copy pathci.yml
File metadata and controls
47 lines (39 loc) · 1.4 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
name: ci
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- name: Format
run: cargo fmt --all --check
# Must precede both Clippy and Test. The registry's tests instantiate the
# programme from its built wasm, the same way the registry does on-chain,
# so the artifact has to exist before anything compiles a test target —
# and `clippy --all-targets` compiles test targets too. Contracts are also
# billed by deployed size, so building here beats discovering it at deploy
# time.
- name: Build wasm
run: cargo build --target wasm32v1-none --release
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Test
run: cargo test --all-features
- name: Report contract sizes
run: |
echo "| contract | bytes |" >> "$GITHUB_STEP_SUMMARY"
echo "| --- | ---: |" >> "$GITHUB_STEP_SUMMARY"
for f in target/wasm32v1-none/release/*.wasm; do
printf '| %s | %s |\n' "$(basename "$f" .wasm)" "$(stat -c%s "$f")" >> "$GITHUB_STEP_SUMMARY"
done