name: CI
on:
  pull_request:
  push:
    branches: [master, 'release-*']
    tags: ['v*']

permissions:
  contents: read

jobs:
  lint:
    name: Lint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Install Go
        uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
        with:
          go-version: 1.26.x
      - run: make check_license
      - run: ./scripts/check_build_tags.sh
      - run: make fixtures
      - run: make update_fixtures
      - run: make style
      - run: git diff --exit-code

  test:
    name: Test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos:
          - linux
          - windows
        go:
          - 1.25.x
          - 1.26.x
    steps:
      - name: Checkout repository
        uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
      - name: Install Go
        uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
        with:
          go-version: ${{ matrix.go }}
      - run: make lint
      - if: matrix.goos == 'linux'
        run: make test
