-
Notifications
You must be signed in to change notification settings - Fork 2
271 lines (224 loc) · 7.06 KB
/
Copy pathci.yml
File metadata and controls
271 lines (224 loc) · 7.06 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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CARGO_TERM_COLOR: always
RUST_VERSION: "1.85"
jobs:
# ============================================
# Rust Tests and Checks
# ============================================
rust:
name: Rust (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-action@stable
with:
toolchain: ${{ env.RUST_VERSION }}
components: rustfmt, clippy
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Build all crates
run: cargo build --all-features
- name: Run tests
run: cargo test --all-features
- name: Check for unused dependencies
if: matrix.os == 'ubuntu-latest'
run: |
cargo install cargo-machete --locked || true
cargo machete || true
# ============================================
# WASM Build
# ============================================
wasm:
name: WASM Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-action@stable
with:
toolchain: ${{ env.RUST_VERSION }}
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: cargo install wasm-pack --locked
- name: Build WASM
run: |
cd crates/mpc-wallet-wasm
wasm-pack build --target web
- name: Check WASM bundle size
run: |
SIZE=$(du -k crates/mpc-wallet-wasm/pkg/mpc_wallet_wasm_bg.wasm | cut -f1)
echo "WASM bundle size: ${SIZE}KB"
if [ $SIZE -gt 2048 ]; then
echo "::warning::WASM bundle is larger than 2MB"
fi
- name: Upload WASM artifact
uses: actions/upload-artifact@v4
with:
name: wasm-pkg
path: crates/mpc-wallet-wasm/pkg/
retention-days: 7
# ============================================
# TypeScript SDK
# ============================================
typescript:
name: TypeScript SDK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: packages/mpc-wallet-sdk/package-lock.json
- name: Install dependencies
working-directory: packages/mpc-wallet-sdk
run: npm ci
- name: Type check
working-directory: packages/mpc-wallet-sdk
run: npm run typecheck
- name: Lint
working-directory: packages/mpc-wallet-sdk
run: npm run lint
- name: Build
working-directory: packages/mpc-wallet-sdk
run: npm run build
- name: Test
working-directory: packages/mpc-wallet-sdk
run: npm test -- --run || true
- name: Check package size
working-directory: packages/mpc-wallet-sdk
run: |
npm pack --dry-run 2>&1 | grep "total files" || true
# ============================================
# Python SDK
# ============================================
python:
name: Python SDK (${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install uv (fast Python package manager)
run: pip install uv
- name: Install dependencies
working-directory: packages/mpc-wallet-python
run: |
uv pip install --system -e ".[dev]"
- name: Lint with Ruff
working-directory: packages/mpc-wallet-python
run: |
uv pip install --system ruff
ruff check src/
- name: Format check with Ruff
working-directory: packages/mpc-wallet-python
run: ruff format --check src/
- name: Type check with mypy
working-directory: packages/mpc-wallet-python
run: mypy src/ || true
- name: Run tests
working-directory: packages/mpc-wallet-python
run: pytest || true
- name: Build package
working-directory: packages/mpc-wallet-python
run: |
uv pip install --system build
python -m build
# ============================================
# Smart Contracts (Foundry)
# ============================================
contracts:
name: Smart Contracts
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
submodules: recursive
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Check formatting
working-directory: contracts
run: forge fmt --check
- name: Build contracts
working-directory: contracts
run: forge build --sizes
- name: Run tests
working-directory: contracts
run: forge test -vvv
- name: Run Slither static analysis
uses: crytic/slither-action@v0.4.0
continue-on-error: true
with:
target: contracts/
sarif: results.sarif
fail-on: none
# ============================================
# Security Audit
# ============================================
security:
name: Security Audit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-action@stable
with:
toolchain: ${{ env.RUST_VERSION }}
- name: Install cargo-audit
run: cargo install cargo-audit --locked
- name: Run cargo audit
run: cargo audit
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '22'
- name: Audit npm dependencies
working-directory: packages/mpc-wallet-sdk
run: npm audit --audit-level=high || true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Audit Python dependencies
working-directory: packages/mpc-wallet-python
run: |
pip install pip-audit
pip-audit || true