name: tests

# Run the gate (make test) on every push and pull request. Chez is the sole
# substrate; the JVM is used only as the conformance oracle (certify).
on:
  push:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
        with:
          submodules: recursive   # vendor/irregex, used by the Chez regex shim

      - name: Install Chez Scheme
        run: |
          sudo apt-get update
          sudo apt-get install -y chezscheme
          # the gate invokes `chez`; Debian/Ubuntu installs it as `scheme`. A symlink
          # won't do — Chez derives its boot-file name from argv0, so `chez` would look
          # for a nonexistent chez.boot. A wrapper that exec's `scheme` keeps argv0.
          if ! command -v chez >/dev/null 2>&1; then
            printf '#!/bin/sh\nexec scheme "$@"\n' | sudo tee /usr/local/bin/chez >/dev/null
            sudo chmod +x /usr/local/bin/chez
          fi
          chez --version || true

      - name: Install JDK + Clojure (certify oracle)
        run: |
          sudo apt-get install -y default-jdk rlwrap
          curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
          sudo bash linux-install.sh
          clojure --version

      - name: Gate
        # `make ci` runs the behavior gates (corpus/unit/smoke/sci/certify). The
        # self-host byte-fixpoint (make selfhost) is a dev-machine check — it only
        # holds on the Chez that minted the seed. See jolt-8479.
        run: make ci
