name: sql-server Integration Tests

on:
  pull_request:
    branches: [ main ]
    paths:
      - 'go/**'
      - 'integration-tests/go-sql-server-driver/**'

concurrency:
  group: ci-sql-server-integration-tests-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  test:
    name: sql-server Integration Tests
    defaults:
      run:
        shell: bash
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os:  [ ubuntu-22.04 ]
    steps:
      - uses: actions/checkout@v4
      - name: Setup Go 1.x
        uses: actions/setup-go@v5
        with:
          go-version-file: go/go.mod
        id: go
      - name: Create CI Bin
        run: |
          mkdir -p ./.ci_bin
      - name: Install Dolt
        working-directory: ./go
        run: |
          go build -mod=readonly -o ../.ci_bin/dolt ./cmd/dolt/
      - name: Test all
        run: |
          export DOLT_BIN_PATH="$(pwd)/../../.ci_bin/dolt"
          go test .
        working-directory: ./integration-tests/go-sql-server-driver
