Update PostgreSQL compatibility and add diagnostic SQL scripts #65
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| permissions: | |
| contents: read | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| on: | |
| push: | |
| branches: ["main", "chore/**", "feature/**", "fix/**"] | |
| pull_request: | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| postgres_version: [14, 15, 16, 17, 18] | |
| env: | |
| PGHOST: localhost | |
| PGPORT: 5432 | |
| PGUSER: postgres | |
| PGDATABASE: postgres | |
| PGPASSWORD: postgres | |
| services: | |
| postgres: | |
| image: postgres:${{ matrix.postgres_version }} | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: postgres | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --name pgtools-postgres-ci | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Show PostgreSQL version under test | |
| run: echo "Running CI against PostgreSQL ${{ matrix.postgres_version }}" | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y shellcheck jq postgresql-client | |
| - name: Wait for PostgreSQL | |
| run: | | |
| for i in {1..10}; do | |
| if pg_isready -h "$PGHOST" -p "$PGPORT" -U "$PGUSER"; then | |
| exit 0 | |
| fi | |
| sleep 2 | |
| done | |
| echo "PostgreSQL did not become ready in time" >&2 | |
| exit 1 | |
| - name: Enable pg_stat_statements | |
| run: | | |
| psql -c "CREATE EXTENSION IF NOT EXISTS pg_stat_statements;" | |
| psql -c "SELECT extname FROM pg_extension WHERE extname = 'pg_stat_statements';" | |
| - name: Configure preload and restart PostgreSQL | |
| run: | | |
| psql -c "ALTER SYSTEM SET shared_preload_libraries = 'pg_stat_statements';" | |
| docker restart pgtools-postgres-ci | |
| for i in {1..30}; do | |
| if pg_isready -h "$PGHOST" -p "$PGPORT" -U "$PGUSER"; then | |
| break | |
| fi | |
| sleep 2 | |
| done | |
| if ! pg_isready -h "$PGHOST" -p "$PGPORT" -U "$PGUSER"; then | |
| echo "PostgreSQL did not become ready after restart" >&2 | |
| exit 1 | |
| fi | |
| psql -tA -c "SHOW shared_preload_libraries;" | grep -q "pg_stat_statements" | |
| psql -c "SELECT extname FROM pg_extension WHERE extname = 'pg_stat_statements';" | |
| - name: ShellCheck all shell scripts | |
| run: | | |
| shellcheck \ | |
| automation/*.sh \ | |
| integration/*.sh \ | |
| configuration/*.sh \ | |
| maintenance/*.sh \ | |
| scripts/*.sh | |
| - name: Fast automation test suite | |
| run: ./automation/test_pgtools.sh --fast | |
| - name: HOT checklist JSON validation | |
| run: ./automation/run_hot_update_report.sh --format json --database "$PGDATABASE" --stdout | |
| - name: HOT checklist text validation | |
| run: ./automation/run_hot_update_report.sh --format text --database "$PGDATABASE" --stdout |