name: CI

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

jobs:
  test:
    name: Build
    strategy:
      matrix:
        go-version: [1.12.x, 1.18.x, 1.19.x, 1.20.x, 1.21.x]
        platform: [ubuntu-20.04]
    runs-on: ${{ matrix.platform }}
    steps:
      - name: Install Go
        uses: actions/setup-go@v5
        with:
          go-version: ${{ matrix.go-version }}

      - name: Check out code into the Go module directory
        uses: actions/checkout@v4

      - name: Build
        run: make build

      - name: Test
        run: make test

  lint:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v4
      - uses: golangci/golangci-lint-action@v6.1.1
        with:
          version: v1.62.2
