Skip to content

feat: Set up CI/CD pipelines, add an environment example, and update … #1

feat: Set up CI/CD pipelines, add an environment example, and update …

feat: Set up CI/CD pipelines, add an environment example, and update … #1

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
check:
name: Check & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Install Stellar CLI
run: cargo install --locked stellar-cli
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy lints
run: cargo clippy --all-targets -- -D warnings
- name: Run unit tests
run: cargo test --workspace --exclude integration-tests
- name: Run integration tests
run: cargo test -p integration-tests
build-wasm:
name: Build WASM & Verify Size
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Cache cargo registry & build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-wasm-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-wasm-
- name: Install Stellar CLI
run: cargo install --locked stellar-cli
- name: Build all contracts
run: stellar contract build
- name: Verify WASM sizes (< 64KB)
run: |
WASM_DIR="target/wasm32v1-none/release"
FAILED=0
for wasm in "$WASM_DIR"/*.wasm; do
NAME=$(basename "$wasm")
SIZE=$(stat -c%s "$wasm" 2>/dev/null || stat -f%z "$wasm")
SIZE_KB=$((SIZE / 1024))
if [ "$SIZE" -gt 65536 ]; then
echo "FAIL: $NAME is ${SIZE_KB}KB (limit: 64KB)"
FAILED=1
else
echo "OK: $NAME — ${SIZE_KB}KB"
fi
done
if [ "$FAILED" -eq 1 ]; then exit 1; fi
- name: Upload WASM artifacts
uses: actions/upload-artifact@v4
with:
name: wasm-contracts
path: target/wasm32v1-none/release/*.wasm
retention-days: 30