name: CI
on: 
  push:
    paths-ignore:
      - '*.md'
      - '*.json'
      - 'LICENSE'
  pull_request:
    paths-ignore:
      - '*.md'
      - '*.json'
      - 'LICENSE'
jobs:
  test:
    strategy:
      matrix:
        pg: [19,18,17,16,15,14,13,12,11]
    name: 🐘 PostgreSQL ${{ matrix.pg }}
    runs-on: ubuntu-latest
    container: pgxn/pgxn-tools
    steps:
      - name: Prepare environment 
        run: sudo apt-get update && sudo apt-get install -y make gcc libxml2-dev libcurl4-openssl-dev
      - name: Start PostgreSQL ${{ matrix.pg }}
        run: pg-start ${{ matrix.pg }}
      - name: Bump max_locks_per_transaction and restart
        run: |
          psql -c "ALTER SYSTEM SET max_locks_per_transaction = 1024;"
          pg_ctlcluster ${{ matrix.pg }} test restart
          psql -c "SHOW max_locks_per_transaction;"
      - uses: actions/checkout@v2
      - name: Build and Regression Tests 
        run: |
          export INCLUDE_EXTERNAL_TESTS=1
          pg-build-test
