name: Check Compatibility

on:
  pull_request:
    branches: [ master ]

jobs:
  test:
    name: Compatibility Test
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: true
      matrix:
        os: [ ubuntu-18.04 ]
    steps:
      - name: Setup Go 1.x
        uses: actions/setup-go@v2
        with:
          go-version: ^1.13
        id: go
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: ^12
      - name: Create CI Bin
        run: |
          mkdir -p ./.ci_bin
          echo "$(pwd)/.ci_bin" >> $GITHUB_PATH
      - name: Install Bats
        run: |
          npm i bats
          echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
        working-directory: ./.ci_bin
      - name: Install Dolt
        working-directory: ./go
        run: |
          go build -mod=readonly -o ../.ci_bin/dolt ./cmd/dolt/.
      - name: Setup Dolt Config
        run: |
          dolt config --global --add user.name 'Liquidata Actions'
          dolt config --global --add user.email 'actions@liquidata.co'
      - name: Test all
        run: ./runner.sh
        working-directory: ./integration-tests/compatibility
