-
Notifications
You must be signed in to change notification settings - Fork 55
79 lines (63 loc) · 2.23 KB
/
ci.yml
File metadata and controls
79 lines (63 loc) · 2.23 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
name: CI
on:
push:
branches: [main]
pull_request:
jobs:
rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
targets: wasm32-unknown-unknown
- name: Cache cargo
uses: Swatinem/rust-cache@v2
- name: Install coverage tools
run: |
cargo install cargo-llvm-cov
cargo install cargo-tarpaulin
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --lib -- -D warnings -A dead_code -A unused_variables
- name: Build WASM (release)
run: cargo build --target wasm32-unknown-unknown --release
- name: Run tests with coverage
run: |
cargo llvm-cov --workspace --lib --bins --tests --all-features --lcov --output-path lcov.info
cargo llvm-cov --workspace --lib --bins --tests --all-features --html
- name: Check coverage thresholds
run: |
COVERAGE=$(cargo llvm-cov --workspace --lib --bins --tests --all-features --json | jq -r '.data[0].totals.percent_covered')
echo "Current coverage: ${COVERAGE}%"
THRESHOLD=80
if (( $(echo "$COVERAGE >= $THRESHOLD" | bc -l) )); then
echo "✅ Coverage threshold met: ${COVERAGE}% >= ${THRESHOLD}%"
else
echo "❌ Coverage threshold NOT met: ${COVERAGE}% < ${THRESHOLD}%"
exit 1
fi
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: lcov.info
flags: unittests
name: codecov-umbrella
- name: Upload coverage artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: target/llvm-cov/html/
- name: Run integration tests
run: cargo test --workspace --test cross_chain_integration
- name: Run comprehensive integration tests
run: |
cd testing/integration
cargo test --lib
- name: Security audit
run: cargo audit --ignore RUSTSEC-2023-0052
- name: Check dependencies
run: cargo deny check