diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4f4d71fc..6bed259e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,21 +2,34 @@ on: workflow_call: name: Tests jobs: + get-go-versions: + name: Collect available Go versions + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.versions.outputs.matrix }} + steps: + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - uses: arnested/go-version-action@v1 + id: versions + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: strategy: matrix: - go-version: [1.16.x, 1.17.x, 1.18.x] os: [ubuntu-latest, macos-latest] + go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }} runs-on: ${{ matrix.os }} + needs: get-go-versions steps: - - name: Setup - Go + - name: Checkout code + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + + - name: Setup - Go ${{ matrix.go-version }} uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 with: go-version: ${{ matrix.go-version }} - - name: Checkout code - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - - name: Setup - Python uses: actions/setup-python@7f80679172b057fc5e90d70d197929d454754a5a with: @@ -41,9 +54,10 @@ jobs: golangci: strategy: matrix: - go-version: [1.16.x, 1.17.x, 1.18.x] + go-version: ${{ fromJSON(needs.get-go-versions.outputs.matrix) }} os: [ubuntu-latest, macos-latest] runs-on: ${{ matrix.os }} + needs: get-go-versions steps: - uses: actions/setup-go@bfdd3570ce990073878bf10f6b2d79082de49492 - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579