name: build-and-test-windows
on:
  push:
    branches: [ main ]
    tags:
      - 'v[0-9]+.[0-9]+.[0-9]+*'
  pull_request:

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

jobs:
  windows-unittest:
    runs-on: windows-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v4
      - name: Setup Go
        uses: actions/setup-go@v4
        with:
          go-version: ~1.20.8
      - name: Cache Go
        uses: actions/cache@v3
        env:
          cache-name: cache-go-modules
        with:
          path: |
            ~\go\pkg\mod
            ~\AppData\Local\go-build
          key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
      - name: Run Unit Tests
        run: make gotest
