name: Setup Rho
description: "Build the local Rho CLI and make the repository shim available on PATH."

inputs:
  build:
    description: "Build the rho and rho-repo debug binaries."
    required: false
    default: "true"

runs:
  using: composite
  steps:
    - uses: dtolnay/rust-toolchain@stable

    - name: Build Rho
      if: inputs.build == 'true'
      shell: bash
      run: |
        set -euo pipefail
        cargo build --locked --bin rho

    - name: Add Rho to PATH
      shell: bash
      run: |
        set -euo pipefail
        chmod +x "${GITHUB_WORKSPACE}/rho"
        echo "${GITHUB_WORKSPACE}" >> "$GITHUB_PATH"
