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
71 changes: 27 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,48 +6,12 @@ on:
pull_request:

jobs:
contracts:
name: Contracts (build + test + lint)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: contracts
- name: Format check
run: cd contracts && cargo fmt --all -- --check
- name: Clippy
run: cd contracts && cargo clippy --all-targets -- -D warnings
- name: Test
run: cd contracts && cargo test
- name: Build wasm
run: cd contracts && cargo build --target wasm32v1-none --release
- name: Upload wasm
uses: actions/upload-artifact@v4
with:
name: stellar_dapp_contract.wasm
path: contracts/target/wasm32v1-none/release/stellar_dapp_contract.wasm
- name: Wasm size check
run: |
SIZE=$(stat -c%s contracts/target/wasm32v1-none/release/stellar_dapp_contract.wasm)
echo "wasm size: $SIZE bytes"
MAX=200000
if [ "$SIZE" -gt "$MAX" ]; then
echo "ERROR: wasm ($SIZE) exceeds budget ($MAX)" >&2
exit 1
fi

frontend:
name: Frontend (install + typecheck + build)
name: Frontend (install + typecheck + lint + build)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
Expand All @@ -58,22 +22,41 @@ jobs:
- name: Typecheck
working-directory: frontend
run: npm run typecheck
- name: Lint
working-directory: frontend
run: npm run lint
- name: Build
working-directory: frontend
run: npm run build

backend:
name: Backend (install + typecheck)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v7
with:
node-version: 20
cache: npm
cache-dependency-path: backend/package-lock.json
- name: Install
working-directory: backend
run: npm ci
- name: Typecheck
working-directory: backend
run: npm run typecheck

audit:
name: Dependency audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: cargo audit
uses: rustsec/audit-check@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
- uses: actions/setup-node@v7
with:
node-version: 20
- name: npm audit
- name: npm audit (frontend)
working-directory: frontend
run: npm audit --audit-level=high
- name: npm audit (backend)
working-directory: backend
run: npm audit --audit-level=high
9 changes: 6 additions & 3 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ if [ "${ALLOW_MAINNET:-0}" != "1" ] && [ "$NETWORK" = "mainnet" ]; then
exit 1
fi

WASM="${WASM_PATH:-contracts/target/wasm32v1-none/release/stellar_dapp_contract.wasm}"
WASM="${WASM_PATH:-../splitlock-contract/target/wasm32v1-none/release/stellar_dapp_contract.wasm}"

if [ ! -f "$WASM" ]; then
echo "WASM not found at $WASM. Building contract first..."
(cd contracts && cargo build --target wasm32v1-none --release)
echo "WASM not found at $WASM."
echo "Build the contract from the splitlock-contract repo first, then set WASM_PATH:"
echo " cd splitlock-contract && cargo build --target wasm32v1-none --release"
echo " WASM_PATH=../splitlock-contract/target/wasm32v1-none/release/stellar_dapp_contract.wasm ./scripts/deploy.sh"
exit 1
fi

ACCOUNT="${STELLAR_ACCOUNT:-testnet account}"
Expand Down
Loading