forked from Stellar-IndigoPay/Stellar-IndigoPay
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (83 loc) · 2.81 KB
/
Copy pathcontracts.yml
File metadata and controls
100 lines (83 loc) · 2.81 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
name: Contracts CI
on:
push:
branches: [main, develop]
paths: [contracts/**]
pull_request:
paths: [contracts/**]
workflow_dispatch:
jobs:
test:
name: Build & Test
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: contracts
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.91.0
targets: wasm32v1-none
components: rustfmt, clippy
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: contracts
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --workspace -- -D warnings
- name: Run tests
run: "cargo test --features testutils --workspace -- --skip fuzz"
- name: Build WASM (slim)
run: cargo build --workspace --target wasm32v1-none --release --no-default-features
- name: Install wasm-opt
run: sudo apt-get update -qq && sudo apt-get install -y -qq binaryen
- name: Check WASM size
run: |
wasm-opt -Oz target/wasm32v1-none/release/indigopay_contract.wasm \
-o target/wasm32v1-none/release/indigopay_contract.opt.wasm
size=$(stat -c%s target/wasm32v1-none/release/indigopay_contract.opt.wasm)
echo "WASM size (slim + wasm-opt): $size bytes"
if [ $size -gt 65536 ]; then
echo "Error: WASM binary exceeds 64KB limit"
exit 1
fi
coverage:
name: Coverage
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: contracts
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.91.0
components: llvm-tools-preview
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: contracts
- name: Cache cargo-tarpaulin binary
id: tarpaulin-cache
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-tarpaulin
key: cargo-tarpaulin-${{ runner.os }}-${{ hashFiles('.github/workflows/contracts.yml') }}
- name: Install cargo-tarpaulin
if: steps.tarpaulin-cache.outputs.cache-hit != 'true'
run: cargo install cargo-tarpaulin
- name: Run coverage
run: cargo tarpaulin --config indigopay-contract/.tarpaulin.toml --features testutils --out Html --out Lcov -- --skip fuzz
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: contracts/indigopay-contract/coverage/