name: zuka

on:
  push:
    paths: ["product/zuka/**"]
  pull_request:
    paths: ["product/zuka/**"]

defaults:
  run:
    working-directory: product/zuka

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt
      - uses: Swatinem/rust-cache@v2
        with:
          workspaces: product/zuka -> target

      - name: Format
        run: cargo fmt --check

      - name: Lint
        run: cargo clippy --all-targets -- -D warnings

      - name: Test
        run: cargo test

      - name: Build release binary
        run: cargo build --release

      # The live suite is where the wire protocol is actually proven, so it runs
      # in CI. A proof that never executes is not a proof.
      - uses: denoland/setup-deno@v2
        with:
          deno-version: v2.x
      - name: Ensure git and ssh client are present
        run: git --version && ssh -V && ssh-keygen --help 2>&1 | head -1 || true

      - name: Live wire-protocol suite
        run: deno task test:live
