name: Go tests

on:
  push:
  pull_request:
  schedule:
    - cron: "22 10 * * *"
  workflow_dispatch:

permissions:
  contents: read

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        go:
          - { go-version: stable }
          - { go-version-file: go.mod }
        deps:
          - locked
          - latest
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false
      - uses: actions/setup-go@v6
        with:
          go-version: ${{ matrix.go.go-version }}
          go-version-file: ${{ matrix.go.go-version-file }}
      - run: |
          if [ "${{ matrix.deps }}" = "latest" ]; then
            go get -u -t ./...
          fi
          go test -v ./...
