name: Go

on:
  push:
    branches: [master, v10, v11]
  pull_request:
    branches: [master, v10, v11]

jobs:
  build:
    name: build
    runs-on: ubuntu-latest
    strategy:
      matrix:
        go-version: [1.21.x, 1.22.x, 1.23.x, 1.24.x, 1.25.x]

    services:
      postgres:
        image: postgres:14
        env:
          POSTGRES_PASSWORD: postgres
        options: >-
          --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
        ports:
          - 5432:5432

    steps:
      - name: Set up ${{ matrix.go-version }}
        uses: actions/setup-go@v2
        with:
          go-version: ${{ matrix.go-version }}

      - name: Checkout code
        uses: actions/checkout@v2

      - name: Install hstore
        run: PGPASSWORD=postgres psql -U postgres -h localhost -c "CREATE EXTENSION hstore"

      - name: Test
        run: make test
