on:
  push:
    branches: [master]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [master]

# for cache
# checkout https://github.com/magnetikonline/action-golang-cache
# https://www.lorenzobettini.it/2020/12/caching-dependencies-in-github-actions/
# https://github.com/mongodb/mongocli/actions/runs/1637632940/workflow

name: GO tests

jobs:
  tests:
    strategy:
      matrix:
        go-version: [1.17]
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v2
      - name: Install Go
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.golang }}
      - name: Cache Dependencies
        uses: actions/cache@v2
        with:
          path: ~/go/pkg/mod # not sure if this part needs editing
          key: ${{ runner.os }}-go-${{ matrix.golang }}-${{ hashFiles('**/go.sum') }}
          restore-keys: |
            ${{ runner.os }}-go-${{ matrix.golang }}-
      - name: Test
        # only test gss for now
        # go test ./... for all
        # after the testdata problems resolved
        # TODO: add makefile for testing
        run: go test ./internal/pkg/gss/
