name: CI on: push: branches: [main] pull_request: branches: [main] env: CARGO_TERM_COLOR: always jobs: fmt-rs: name: Rust Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install nightly toolchain for rustfmt run: rustup install nightly --profile minimal --component rustfmt - name: Check Rust files are formatted run: cargo +nightly fmt --all -- --check fmt-toml: name: TOML Format runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install taplo-cli run: cargo install --locked taplo-cli - name: Check TOML files are formatted run: taplo fmt --check . lint: name: Lint runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install-risc0 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: toolchain: "1.94.0" components: clippy - name: Cache cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: Clippy run: | if rg -n -U --multiline '#\[(allow|expect)\([\s\S]*?reason\s*=\s*"(TODO|FIXME|fix later|later|temporary|hack)' token amm ata integration_tests tools -g '*.rs'; then echo "Found non-actionable lint suppression reason" exit 1 fi RISC0_SKIP_BUILD=1 cargo clippy --workspace --all-targets -- -D warnings - name: Guest Clippy run: | for manifest in \ token/methods/guest/Cargo.toml \ amm/methods/guest/Cargo.toml \ ata/methods/guest/Cargo.toml do cargo clippy --manifest-path "$manifest" --all-targets -- -D warnings done unit-tests: name: Unit Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install-risc0 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: toolchain: "1.94.0" - name: Cache cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: Unit tests run: cargo test --workspace --exclude integration_tests env: RISC0_DEV_MODE: 1 integration-tests: name: Integration Tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: ./.github/actions/install-risc0 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: toolchain: "1.94.0" - name: Cache cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: Integration tests run: cargo test -p integration_tests env: RISC0_DEV_MODE: 1 check-idl: name: Check IDL runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@master with: toolchain: "1.94.0" - name: Cache cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo- - name: Build idl-gen run: cargo build -p idl-gen --release - name: Check IDL files are present and up to date run: | set -e failed=0 for src in $(find . -path '*/methods/guest/src/bin/*.rs' | sort); do program=$(basename "$src" .rs) idl="artifacts/${program}-idl.json" if [ ! -f "$idl" ]; then echo "Missing IDL for '${program}' — generate with: cargo run -p idl-gen -- ${src#./} > ${idl}" failed=1 continue fi ./target/release/idl-gen "$src" > /tmp/${program}-idl.json if ! diff "$idl" /tmp/${program}-idl.json > /dev/null 2>&1; then echo "IDL for '${program}' is out of date — regenerate with: cargo run -p idl-gen -- ${src#./} > ${idl}" failed=1 fi done exit $failed