-
Notifications
You must be signed in to change notification settings - Fork 34
75 lines (62 loc) · 1.99 KB
/
Copy pathci.yml
File metadata and controls
75 lines (62 loc) · 1.99 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
name: CI
on:
pull_request:
branches: [main]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: Build & Test Contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@1.70
with:
targets: wasm32-unknown-unknown
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles("**/Cargo.lock", "**/Cargo.toml") }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build contracts
run: cargo build --release --target wasm32-unknown-unknown
- name: Verify wasm build output
run: |
set -euo pipefail
out_dir="target/wasm32-unknown-unknown/release"
expected="credential_nft learn_token progress_tracker"
for name in $expected; do
wasm_file="$out_dir/$name.wasm"
if [ ! -f "$wasm_file" ]; then
echo "::error::Expected wasm output missing: $wasm_file"
exit 1
fi
size=$(stat -c%s "$wasm_file")
if [ "$size" -eq 0 ]; then
echo "::error::Wasm output is empty: $wasm_file"
exit 1
fi
echo "OK: $wasm_file ($size bytes)"
done
- name: Run tests
run: cargo test --workspace
- name: Run clippy
run: cargo clippy --workspace --all-targets -- -D warnings
- name: Check formatting
run: cargo fmt --all -- --check
- name: Install cargo-audit
run: cargo install cargo-audit
- name: Run security audit
run: cargo audit
- name: Check licenses, advisories & banned dependencies
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check all