name: Build

on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize

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

jobs:
  build:
    strategy:
      fail-fast: true
    runs-on: ubuntu-latest
    steps:
      - name: Install Go
        uses: actions/setup-go@v5
        with:
          go-version: 1.22
      - name: Checkout code
        uses: actions/checkout@v4
      - uses: actions/cache@v4
        with:
          path: /home/runner/go/pkg/mod
          key: go-mod
      - name: Build and run tests
        run: |
          make test