name: Check Non-zkVM crates

on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
  workflow_dispatch:

jobs:
  test_interface_crates:
    name: Build and Test Interface Crates
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set up Rust toolchain (stable)
        uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - name: Cache Cargo dependencies
        uses: Swatinem/rust-cache@v2
        with:
          key: zkvm-interface-deps

      - name: Check zkvm-interface
        run: cargo check --package zkvm-interface --verbose

      - name: Test zkvm-interface
        run: cargo test --package zkvm-interface --verbose

      - name: Check formatting for zkvm-interface
        run: cargo fmt --package zkvm-interface -- --check

      - name: Run Clippy for zkvm-interface
        run: cargo clippy --package zkvm-interface -- -D warnings