name: Go CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]
  workflow_dispatch:

jobs:
  test:
    name: Run Tests & Linter
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v7

      - name: Set up Go
        uses: actions/setup-go@v6
        with:
          go-version: "1.26"

 #     - name: Cache Go modules
 #       uses: actions/cache@v3
 #       with:
 #         path: |
 #          ~/.cache/go-build
 #          ~/go/pkg/mod
 #         key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
 #        restore-keys: |
 #           ${{ runner.os }}-go-

      - name: Install dependencies
        run: go mod tidy

      - name: Run unit tests
        run: go test -v ./...

      - name: Run linter (golangci-lint)
        uses: golangci/golangci-lint-action@v9
        with:
          version: latest
          args: --timeout=3m
