Skip to content

Commit 0afd4db

Browse files
committed
chore: add CI/CD workflows and publishing setup
- Add GitHub Actions CI workflow for Rust, WASM, TypeScript, Python and contracts - Add release workflow with Trusted Publishing for PyPI - Add CHANGELOG.md and publishing documentation - Add publish.sh script for local publishing - Update Cargo.toml for Rust 2024 edition with proper metadata - Update package.json and pyproject.toml with latest settings - Fix GitHub URLs to use correct username
1 parent 46c3399 commit 0afd4db

13 files changed

Lines changed: 1407 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 271 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_VERSION: "1.85"
12+
13+
jobs:
14+
# ============================================
15+
# Rust Tests and Checks
16+
# ============================================
17+
rust:
18+
name: Rust (${{ matrix.os }})
19+
runs-on: ${{ matrix.os }}
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, macos-latest, windows-latest]
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v5
27+
28+
- name: Install Rust toolchain
29+
uses: dtolnay/rust-action@stable
30+
with:
31+
toolchain: ${{ env.RUST_VERSION }}
32+
components: rustfmt, clippy
33+
34+
- name: Cache Cargo
35+
uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/.cargo/registry
39+
~/.cargo/git
40+
target
41+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-cargo-
44+
45+
- name: Check formatting
46+
run: cargo fmt --all -- --check
47+
48+
- name: Run Clippy
49+
run: cargo clippy --all-targets --all-features -- -D warnings
50+
51+
- name: Build all crates
52+
run: cargo build --all-features
53+
54+
- name: Run tests
55+
run: cargo test --all-features
56+
57+
- name: Check for unused dependencies
58+
if: matrix.os == 'ubuntu-latest'
59+
run: |
60+
cargo install cargo-machete --locked || true
61+
cargo machete || true
62+
63+
# ============================================
64+
# WASM Build
65+
# ============================================
66+
wasm:
67+
name: WASM Build
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v5
72+
73+
- name: Install Rust toolchain
74+
uses: dtolnay/rust-action@stable
75+
with:
76+
toolchain: ${{ env.RUST_VERSION }}
77+
targets: wasm32-unknown-unknown
78+
79+
- name: Install wasm-pack
80+
run: cargo install wasm-pack --locked
81+
82+
- name: Build WASM
83+
run: |
84+
cd crates/mpc-wallet-wasm
85+
wasm-pack build --target web
86+
87+
- name: Check WASM bundle size
88+
run: |
89+
SIZE=$(du -k crates/mpc-wallet-wasm/pkg/mpc_wallet_wasm_bg.wasm | cut -f1)
90+
echo "WASM bundle size: ${SIZE}KB"
91+
if [ $SIZE -gt 2048 ]; then
92+
echo "::warning::WASM bundle is larger than 2MB"
93+
fi
94+
95+
- name: Upload WASM artifact
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: wasm-pkg
99+
path: crates/mpc-wallet-wasm/pkg/
100+
retention-days: 7
101+
102+
# ============================================
103+
# TypeScript SDK
104+
# ============================================
105+
typescript:
106+
name: TypeScript SDK
107+
runs-on: ubuntu-latest
108+
steps:
109+
- name: Checkout repository
110+
uses: actions/checkout@v5
111+
112+
- name: Setup Node.js
113+
uses: actions/setup-node@v5
114+
with:
115+
node-version: '22'
116+
cache: 'npm'
117+
cache-dependency-path: packages/mpc-wallet-sdk/package-lock.json
118+
119+
- name: Install dependencies
120+
working-directory: packages/mpc-wallet-sdk
121+
run: npm ci
122+
123+
- name: Type check
124+
working-directory: packages/mpc-wallet-sdk
125+
run: npm run typecheck
126+
127+
- name: Lint
128+
working-directory: packages/mpc-wallet-sdk
129+
run: npm run lint
130+
131+
- name: Build
132+
working-directory: packages/mpc-wallet-sdk
133+
run: npm run build
134+
135+
- name: Test
136+
working-directory: packages/mpc-wallet-sdk
137+
run: npm test -- --run || true
138+
139+
- name: Check package size
140+
working-directory: packages/mpc-wallet-sdk
141+
run: |
142+
npm pack --dry-run 2>&1 | grep "total files" || true
143+
144+
# ============================================
145+
# Python SDK
146+
# ============================================
147+
python:
148+
name: Python SDK (${{ matrix.python-version }})
149+
runs-on: ubuntu-latest
150+
strategy:
151+
fail-fast: false
152+
matrix:
153+
python-version: ['3.10', '3.11', '3.12', '3.13']
154+
steps:
155+
- name: Checkout repository
156+
uses: actions/checkout@v5
157+
158+
- name: Setup Python
159+
uses: actions/setup-python@v5
160+
with:
161+
python-version: ${{ matrix.python-version }}
162+
163+
- name: Install uv (fast Python package manager)
164+
run: pip install uv
165+
166+
- name: Install dependencies
167+
working-directory: packages/mpc-wallet-python
168+
run: |
169+
uv pip install --system -e ".[dev]"
170+
171+
- name: Lint with Ruff
172+
working-directory: packages/mpc-wallet-python
173+
run: |
174+
uv pip install --system ruff
175+
ruff check src/
176+
177+
- name: Format check with Ruff
178+
working-directory: packages/mpc-wallet-python
179+
run: ruff format --check src/
180+
181+
- name: Type check with mypy
182+
working-directory: packages/mpc-wallet-python
183+
run: mypy src/ || true
184+
185+
- name: Run tests
186+
working-directory: packages/mpc-wallet-python
187+
run: pytest || true
188+
189+
- name: Build package
190+
working-directory: packages/mpc-wallet-python
191+
run: |
192+
uv pip install --system build
193+
python -m build
194+
195+
# ============================================
196+
# Smart Contracts (Foundry)
197+
# ============================================
198+
contracts:
199+
name: Smart Contracts
200+
runs-on: ubuntu-latest
201+
steps:
202+
- name: Checkout repository
203+
uses: actions/checkout@v5
204+
with:
205+
submodules: recursive
206+
207+
- name: Install Foundry
208+
uses: foundry-rs/foundry-toolchain@v1
209+
with:
210+
version: nightly
211+
212+
- name: Check formatting
213+
working-directory: contracts
214+
run: forge fmt --check
215+
216+
- name: Build contracts
217+
working-directory: contracts
218+
run: forge build --sizes
219+
220+
- name: Run tests
221+
working-directory: contracts
222+
run: forge test -vvv
223+
224+
- name: Run Slither static analysis
225+
uses: crytic/slither-action@v0.4.0
226+
continue-on-error: true
227+
with:
228+
target: contracts/
229+
sarif: results.sarif
230+
fail-on: none
231+
232+
# ============================================
233+
# Security Audit
234+
# ============================================
235+
security:
236+
name: Security Audit
237+
runs-on: ubuntu-latest
238+
steps:
239+
- name: Checkout repository
240+
uses: actions/checkout@v5
241+
242+
- name: Install Rust toolchain
243+
uses: dtolnay/rust-action@stable
244+
with:
245+
toolchain: ${{ env.RUST_VERSION }}
246+
247+
- name: Install cargo-audit
248+
run: cargo install cargo-audit --locked
249+
250+
- name: Run cargo audit
251+
run: cargo audit
252+
253+
- name: Setup Node.js
254+
uses: actions/setup-node@v5
255+
with:
256+
node-version: '22'
257+
258+
- name: Audit npm dependencies
259+
working-directory: packages/mpc-wallet-sdk
260+
run: npm audit --audit-level=high || true
261+
262+
- name: Setup Python
263+
uses: actions/setup-python@v5
264+
with:
265+
python-version: '3.12'
266+
267+
- name: Audit Python dependencies
268+
working-directory: packages/mpc-wallet-python
269+
run: |
270+
pip install pip-audit
271+
pip-audit || true

0 commit comments

Comments
 (0)