Refactor: replace hardcoded literals with shared constants and add guardrails #104
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: Rust CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| jobs: | |
| ci: | |
| name: Rust CI | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./contracts | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| targets: wasm32-unknown-unknown, wasm32v1-none | |
| - name: Cache cargo build artifacts | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| cache-on-failure: true | |
| workspaces: "./contracts" | |
| - name: Install Stellar CLI | |
| uses: stellar/stellar-cli@v23.0.1 | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| - name: Run Clippy | |
| run: cargo clippy --all-targets --all-features -- -D warnings | |
| - name: Run tests | |
| run: cargo test | |
| - name: Build all Wasm artifacts | |
| run: stellar contract build |