name: CI

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v6
    
    - name: Set up Go
      uses: actions/setup-go@v6
      with:
        go-version: '1.25'
    
    - name: Cache Go modules
      uses: actions/cache@v5
      with:
        path: ~/go/pkg/mod
        key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
        restore-keys: |
          ${{ runner.os }}-go-
    
    - name: Install tools
      run: |
        go install golang.org/x/tools/cmd/goimports@latest
        curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.8.0
    
    - name: Build
      run: make all
