fix: update repository URL to ApexChainx org and fix upstream remote … #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| name: Test & Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| targets: wasm32-unknown-unknown | |
| - name: Cache Cargo dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: apexchainx_calculator | |
| - name: Check formatting | |
| run: cargo fmt --manifest-path apexchainx_calculator/Cargo.toml -- --check | |
| - name: Clippy (no-std compatible) | |
| run: cargo clippy --manifest-path apexchainx_calculator/Cargo.toml -- -D warnings | |
| - name: Run tests | |
| run: cargo test --manifest-path apexchainx_calculator/Cargo.toml | |
| # SC-077 — verify the crate compiles for the wasm32 target | |
| - name: Build wasm32 target | |
| run: cargo build --release --manifest-path apexchainx_calculator/Cargo.toml --target wasm32-unknown-unknown | |
| # SC-044 — explicit no-std check: compile the library crate (not tests) for | |
| # wasm32-unknown-unknown, which has no std. This catches accidental std | |
| # imports (e.g. std::vec, std::string, println!) that cargo test on the host | |
| # would silently accept because the test harness re-enables std. | |
| # The wasm32 target has no OS and no std by default, so any std usage that | |
| # slips past #![no_std] will surface here as a compile error before it ever | |
| # reaches a deployed contract. | |
| - name: no-std compliance check (wasm32) | |
| run: cargo check --manifest-path apexchainx_calculator/Cargo.toml --target wasm32-unknown-unknown --lib | |
| # SC-078 — surface contract size after release build | |
| - name: Check contract binary size | |
| run: | | |
| WASM=apexchainx_calculator/target/wasm32-unknown-unknown/release/apexchainx_calculator.wasm | |
| SIZE=$(wc -c < "$WASM") | |
| echo "Contract size: ${SIZE} bytes" | |
| MAX=102400 # 100 KB soft limit | |
| if [ "$SIZE" -gt "$MAX" ]; then | |
| echo "::warning::Contract binary (${SIZE}B) exceeds soft limit of ${MAX}B" | |
| fi |