Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 120 additions & 120 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
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 checks for non-contract PRs
if: github.event_name == 'pull_request' && steps.changes.outputs.contracts != 'true'
run: echo "No contract changes detected; skipping Soroban build and test 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
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
cargo test --verbose

- name: Test coverage (baseline + admin gate)
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
cargo install cargo-llvm-cov
# TODO: ratchet back toward the original 95% gate as the legacy
# test suite is repaired. The previous 50% floor was calibrated to
# the stubbed crate root; issue #2963 re-declared the production
# modules in lib.rs (the dispute machinery must compile for its
# enforcement to exist), whose current baseline line coverage is
# 23.7%. Floor set just under that baseline so coverage can only
# improve from here.
cargo llvm-cov --lib --fail-under-lines 23
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
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 checks for non-contract PRs
if: github.event_name == 'pull_request' && steps.changes.outputs.contracts != 'true'
run: echo "No contract changes detected; skipping Soroban build and test 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
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
cargo test --verbose
- name: Test coverage (baseline + admin gate)
if: github.event_name != 'pull_request' || steps.changes.outputs.contracts == 'true'
run: |
source $HOME/.cargo/env
cargo install cargo-llvm-cov
# TODO: ratchet back toward the original 95% gate as the legacy
# test suite is repaired. The previous 50% floor was calibrated to
# the stubbed crate root; issue #2963 re-declared the production
# modules in lib.rs (the dispute machinery must compile for its
# enforcement to exist), whose current baseline line coverage is
# 23.7%. Floor set just under that baseline so coverage can only
# improve from here.
cargo llvm-cov --lib --fail-under-lines 23
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
Loading
Loading