Merge pull request #71 from seanwevans/claude/fix-ci-and-regress-list #158
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 | |
| on: | |
| push: | |
| pull_request: | |
| env: | |
| PG_MAJOR: "16" | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install PostgreSQL and development headers | |
| run: | | |
| sudo apt-get update | |
| # The GitHub runner image already has the PGDG apt repo and a newer | |
| # postgresql-common, which conflicts with the archive's | |
| # postgresql-server-dev-all meta-package. Install versioned packages | |
| # so apt stays on the PGDG line. | |
| sudo apt-get install -y \ | |
| "postgresql-${PG_MAJOR}" \ | |
| "postgresql-server-dev-${PG_MAJOR}" \ | |
| libpq-dev | |
| - name: Start the PostgreSQL cluster | |
| run: | | |
| # The cluster may already exist on the runner; create it only if not. | |
| if ! pg_lsclusters -h | awk '{print $1, $2}' | grep -qx "${PG_MAJOR} main"; then | |
| sudo pg_createcluster "${PG_MAJOR}" main | |
| fi | |
| sudo pg_ctlcluster "${PG_MAJOR}" main start || true | |
| # Whatever port the cluster ended up on, route all later steps to it. | |
| PORT=$(pg_lsclusters -h | awk -v v="${PG_MAJOR}" '$1==v && $2=="main" {print $3}') | |
| echo "PGHOST=/var/run/postgresql" >> "$GITHUB_ENV" | |
| echo "PGPORT=$PORT" >> "$GITHUB_ENV" | |
| - name: Create a superuser role for the runner | |
| run: | | |
| # pg_regress connects over the local socket as the current OS user via | |
| # peer authentication, so that user needs a matching superuser role. | |
| sudo -u postgres psql -p "$PGPORT" -d postgres \ | |
| -c "CREATE ROLE \"$(whoami)\" SUPERUSER LOGIN;" || true | |
| sudo -u postgres createdb -p "$PGPORT" -O "$(whoami)" "$(whoami)" || true | |
| - name: Build and install the extension | |
| run: | | |
| make PG_CONFIG="/usr/lib/postgresql/${PG_MAJOR}/bin/pg_config" | |
| sudo make PG_CONFIG="/usr/lib/postgresql/${PG_MAJOR}/bin/pg_config" install | |
| - name: Run regression tests | |
| run: make PG_CONFIG="/usr/lib/postgresql/${PG_MAJOR}/bin/pg_config" installcheck | |
| - name: Show regression diffs on failure | |
| if: failure() | |
| run: cat tmp_pg_os_regress/regression.diffs || true |