name: Commandline tests

on:
  push:
    branches-ignore:
      - 'test-*'
  pull_request_target:
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:

  build:
    name: Test
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest, ubuntu-latest, windows-latest]
    steps:

    - name: Set up Go 1.19
      uses: actions/setup-go@v4
      with:
        go-version: 1.19
      id: go

    - name: Check out code
      uses: actions/checkout@v3

    - name: Install windows build helpers
      if: startsWith(matrix.os, 'windows')
      run: choco install mingw

    - name: Install libcurl
      if: startsWith(matrix.os, 'ubuntu')
      run: sudo apt install libcurl4-openssl-dev

    - name: Run tests
      run: go run ./rig.go
      working-directory: ./testrig

