-
Notifications
You must be signed in to change notification settings - Fork 343
112 lines (98 loc) · 4.03 KB
/
Copy pathci.yml
File metadata and controls
112 lines (98 loc) · 4.03 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
name: Soroban Smart Contracts CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect contract-impacting changes
id: changes
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@v3
with:
filters: |
contracts:
- 'quicklendx-contracts/**'
- name: Skip contract build for docs-only PRs
if: github.event_name == 'pull_request' && steps.changes.outputs.contracts != 'true'
run: echo "Docs-only PR detected; skipping Soroban contract build steps."
- name: Install Rust
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
- name: Install Rust target for Soroban
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
rustup target add wasm32v1-none
- name: Detect optional Stellar CLI
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
if command -v stellar >/dev/null 2>&1; then
stellar --version
else
echo "stellar CLI not found; WASM build step will fall back to cargo."
fi
- name: Build Cargo project
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
cd quicklendx-contracts
cargo build --verbose
- name: Check code quality
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
cd quicklendx-contracts
cargo check --lib --verbose
- name: Install wasm-opt (binaryen) for size reduction
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y binaryen
elif command -v brew >/dev/null 2>&1; then
brew install binaryen
else
echo "No supported package manager found for binaryen install."
exit 1
fi
wasm-opt --version
- name: Build and check WASM size budget (shell script)
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
quicklendx-contracts/scripts/check-wasm-size.sh
- name: Run WASM size budget regression tests
# Runs tests/wasm_build_size_budget.rs – a self-contained integration test
# that does NOT import contract types, so it compiles independently of the
# legacy test suite. It enforces:
# • hard budget (256 KiB)
# • warning zone (90 % of budget)
# • regression limit (baseline + 5 % margin)
# plus ~30 fast unit tests for constants, classify_size, and helpers.
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
cd quicklendx-contracts
cargo test --test wasm_build_size_budget --verbose
- name: Run Cargo tests
run: |
source $HOME/.cargo/env
cargo test --verbose
- name: Test coverage (baseline + admin gate)
run: |
source $HOME/.cargo/env
cargo install cargo-llvm-cov
# TODO: restore the original 95% gate after the legacy test suite is repaired.
cargo llvm-cov --lib --fail-under-lines 50
cd quicklendx-contracts
cargo llvm-cov clean --workspace
cargo llvm-cov --lib --lcov --output-path coverage/lcov.info
bash scripts/check-admin-coverage.sh coverage/lcov.info