diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81b9140..ae5ae8b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/scripts/deploy.sh b/scripts/deploy.sh index cdb7b2e..026bcea 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -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}"