ouro 0.1.0

A golden test runner for language hackers
Documentation
name: 'ouro'
description: 'Golden test runner for language hackers'
author: 'NickTomlin'

branding:
  icon: 'check-circle'
  color: 'blue'

inputs:
  binary:
    description: 'Path to the binary under test (e.g. target/debug/myc)'
    required: false
  files:
    description: 'Glob of test files (e.g. "tests/**/*.myc")'
    required: false
  prefix:
    description: 'Comment prefix used to identify directive lines (e.g. "// ", "# ")'
    required: false
  update:
    description: 'Rewrite directive lines with actual output instead of failing'
    required: false
    default: 'false'
  jobs:
    description: 'Number of parallel workers'
    required: false
  config:
    description: 'Path to ouro.toml config file'
    required: false
  version:
    description: 'ouro version to download (e.g. "0.1.0"). Defaults to latest.'
    required: false
    default: 'latest'

runs:
  using: composite
  steps:
    - name: Install ouro
      shell: bash
      env:
        OURO_VERSION: ${{ inputs.version }}
      run: |
        case "${{ runner.os }}" in
          Linux)   ASSET="ouro-linux-x86_64" ;;
          macOS)
            if [ "${{ runner.arch }}" = "ARM64" ]; then
              ASSET="ouro-macos-aarch64"
            else
              ASSET="ouro-macos-x86_64"
            fi ;;
          Windows) ASSET="ouro-windows-x86_64.exe" ;;
          *)
            echo "Unsupported OS: ${{ runner.os }}" >&2
            exit 1 ;;
        esac

        if [ "$OURO_VERSION" = "latest" ]; then
          URL="https://github.com/NickTomlin/ouro/releases/latest/download/$ASSET"
        else
          URL="https://github.com/NickTomlin/ouro/releases/download/v${OURO_VERSION}/$ASSET"
        fi

        DEST="$RUNNER_TEMP/ouro-bin"
        mkdir -p "$DEST"
        curl -sSfL "$URL" -o "$DEST/ouro"
        chmod +x "$DEST/ouro"
        echo "$DEST" >> "$GITHUB_PATH"

    - name: Run ouro
      shell: bash
      run: |
        ARGS=()
        [ -n "${{ inputs.binary }}" ] && ARGS+=(--binary "${{ inputs.binary }}")
        [ -n "${{ inputs.files }}" ]  && ARGS+=(--files  "${{ inputs.files }}")
        [ -n "${{ inputs.prefix }}" ] && ARGS+=(--prefix "${{ inputs.prefix }}")
        [ -n "${{ inputs.jobs }}" ]   && ARGS+=(--jobs   "${{ inputs.jobs }}")
        [ -n "${{ inputs.config }}" ] && ARGS+=(--config "${{ inputs.config }}")
        [ "${{ inputs.update }}" = "true" ] && ARGS+=(--update)
        ouro "${ARGS[@]}"