name: Validate 'setup-go'
on:
  push:
    branches:
      - main
    paths-ignore:
      - '**.md'
  pull_request:
    paths-ignore:
      - '**.md'
  schedule:
    - cron: 0 0 * * *

jobs:
  local-cache:
    name: Setup local-cache version
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
        go: [1.12, 1.13, 1.14]
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: setup-go ${{ matrix.go }}
        uses: ./
        with:
          go-version: ${{ matrix.go }}

      - name: verify go
        run: __tests__/verify-go.sh ${{ matrix.go }}
        shell: bash

  setup-versions-from-manifest:
    name: Setup ${{ matrix.go }} ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
        go: [1.12.16, 1.13.11, 1.14.3]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      
      - name: setup-go ${{ matrix.go }}
        uses: ./
        with:
          go-version: ${{ matrix.go }}
      
      - name: verify go
        run: __tests__/verify-go.sh ${{ matrix.go }}
        shell: bash

  setup-versions-from-dist:
    name: Setup ${{ matrix.go }} ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
        go: [1.7, 1.8.6]
    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: setup-go ${{ matrix.go }}
      uses: ./
      with:
        go-version: ${{ matrix.go }}
    - name: verify go
      run: __tests__/verify-go.sh ${{ matrix.go }}
      shell: bash