From d435d1e2c4236ef808ba1e94d850eae4b0501308 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 23 Jul 2025 19:16:40 +0200 Subject: [PATCH 1/3] Add a CI build to check postgres repository changes. The CI builds Postgres from the source code in this branch installed in the neon vendor/postgres-vXX directory, and then runs the Postgres regression tests and a very simple Neon test that just does CREATE EXTENSION neon. This allows making sure we can still build Neon with the current code in the branch, and load the neon shared library at the server's start-up. We might want to add more commands in contrib/neon/sql/neon.sql for more coverage. Actual neon testing is still maintained in the neon repository, the goal of this CI action is to have a minimum amount of feedback when contributing to the Postgres repository. --- .github/workflows/build.yml | 60 ++++++++++++++++++++++++++++++++++ contrib/neon/Makefile | 7 ++++ contrib/neon/README.md | 7 ++++ contrib/neon/expected/neon.out | 1 + contrib/neon/results/neon.out | 1 + contrib/neon/sql/neon.sql | 1 + 6 files changed, 77 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 contrib/neon/Makefile create mode 100644 contrib/neon/README.md create mode 100644 contrib/neon/expected/neon.out create mode 100644 contrib/neon/results/neon.out create mode 100644 contrib/neon/sql/neon.sql diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..25b3ad267b1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,60 @@ +name: Build Postgres + +on: + push: + branches: + - REL_14_STABLE_neon + pull_request: + branches: + - REL_14_STABLE_neon + +jobs: + build_postgres: + name: Build Postgres + runs-on: ubuntu-latest + steps: + - name: Install Postgres Build Dependencies + run: | + sudo apt-get install build-essential coreutils libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc git + + - name: Install Neon Build Dependencies + run: | + sudo apt install libtool libseccomp-dev clang pkg-config cmake postgresql-client protobuf-compiler libprotobuf-dev libcurl4-openssl-dev openssl libicu-dev + + - name: Checkout Neon main branch + run: | + git clone https://github.com/neondatabase/neon ./neon + + - name: Checkout postgres repository + uses: actions/checkout@v4 + with: + path: './neon/vendor/postgres-v14' + + - name: Build PostgreSQL and Neon Extension + run: | + make -s -j`nproc` -C ./neon -s neon-pg-ext-v14 + + - name: Run PostgreSQL Test Suite + run: | + make -s -j`nproc` -C ./neon/build/v14 check + + - name: Append Postgres binaries to the PATH + run: | + echo "./neon/pg_install/v14/bin" >> "$GITHUB_PATH" + + - name: Start Postgres + run: | + pg_ctl init --pgdata ./data + pg_ctl start --pgdata ./data -o '-c shared_preload_libraries=neon' + + - name: Minimal Check for Neon Extension + env: + PGHOST: /tmp + PGDATA: ./data + PG_CONFIG: ./neon/pg_install/v14/bin/pg_config + run: | + make -C ./neon/vendor/postgres-v14/contrib/neon installcheck + + - name: Stop Postgres + run: | + pg_ctl stop --pgdata ./data diff --git a/contrib/neon/Makefile b/contrib/neon/Makefile new file mode 100644 index 00000000000..411540e755c --- /dev/null +++ b/contrib/neon/Makefile @@ -0,0 +1,7 @@ +# contrib/neon/Makefile + +REGRESS = neon + +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) diff --git a/contrib/neon/README.md b/contrib/neon/README.md new file mode 100644 index 00000000000..c2d4d7c0d66 --- /dev/null +++ b/contrib/neon/README.md @@ -0,0 +1,7 @@ +This directory is meant to run limited testing on the Neon extension. + +The Neon extension is managed separately at +https://github.com/neondatabase/neon, see the CI integration for usage of +this directory. + + make installcheck diff --git a/contrib/neon/expected/neon.out b/contrib/neon/expected/neon.out new file mode 100644 index 00000000000..57b7d29bfca --- /dev/null +++ b/contrib/neon/expected/neon.out @@ -0,0 +1 @@ +create extension neon; diff --git a/contrib/neon/results/neon.out b/contrib/neon/results/neon.out new file mode 100644 index 00000000000..57b7d29bfca --- /dev/null +++ b/contrib/neon/results/neon.out @@ -0,0 +1 @@ +create extension neon; diff --git a/contrib/neon/sql/neon.sql b/contrib/neon/sql/neon.sql new file mode 100644 index 00000000000..57b7d29bfca --- /dev/null +++ b/contrib/neon/sql/neon.sql @@ -0,0 +1 @@ +create extension neon; From 8eeeb6ee563f82db8a90a389bb91b0a433ef1da0 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Thu, 24 Jul 2025 12:32:25 +0200 Subject: [PATCH 2/3] Rework the create extension neon test. --- .github/workflows/build.yml | 6 ++---- contrib/neon/Makefile | 7 ------- contrib/neon/README.md | 7 ------- contrib/neon/expected/neon.out | 1 - contrib/neon/results/neon.out | 1 - contrib/neon/sql/neon.sql | 1 - 6 files changed, 2 insertions(+), 21 deletions(-) delete mode 100644 contrib/neon/Makefile delete mode 100644 contrib/neon/README.md delete mode 100644 contrib/neon/expected/neon.out delete mode 100644 contrib/neon/results/neon.out delete mode 100644 contrib/neon/sql/neon.sql diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25b3ad267b1..c7f59aa4514 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,13 +47,11 @@ jobs: pg_ctl init --pgdata ./data pg_ctl start --pgdata ./data -o '-c shared_preload_libraries=neon' - - name: Minimal Check for Neon Extension + - name: Create Extension Neon env: PGHOST: /tmp - PGDATA: ./data - PG_CONFIG: ./neon/pg_install/v14/bin/pg_config run: | - make -C ./neon/vendor/postgres-v14/contrib/neon installcheck + psql -c 'create extension neon;' - name: Stop Postgres run: | diff --git a/contrib/neon/Makefile b/contrib/neon/Makefile deleted file mode 100644 index 411540e755c..00000000000 --- a/contrib/neon/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# contrib/neon/Makefile - -REGRESS = neon - -PG_CONFIG = pg_config -PGXS := $(shell $(PG_CONFIG) --pgxs) -include $(PGXS) diff --git a/contrib/neon/README.md b/contrib/neon/README.md deleted file mode 100644 index c2d4d7c0d66..00000000000 --- a/contrib/neon/README.md +++ /dev/null @@ -1,7 +0,0 @@ -This directory is meant to run limited testing on the Neon extension. - -The Neon extension is managed separately at -https://github.com/neondatabase/neon, see the CI integration for usage of -this directory. - - make installcheck diff --git a/contrib/neon/expected/neon.out b/contrib/neon/expected/neon.out deleted file mode 100644 index 57b7d29bfca..00000000000 --- a/contrib/neon/expected/neon.out +++ /dev/null @@ -1 +0,0 @@ -create extension neon; diff --git a/contrib/neon/results/neon.out b/contrib/neon/results/neon.out deleted file mode 100644 index 57b7d29bfca..00000000000 --- a/contrib/neon/results/neon.out +++ /dev/null @@ -1 +0,0 @@ -create extension neon; diff --git a/contrib/neon/sql/neon.sql b/contrib/neon/sql/neon.sql deleted file mode 100644 index 57b7d29bfca..00000000000 --- a/contrib/neon/sql/neon.sql +++ /dev/null @@ -1 +0,0 @@ -create extension neon; From 720859099df6b950f5595a38b95c24bf96c668f3 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Thu, 24 Jul 2025 13:22:40 +0200 Subject: [PATCH 3/3] Connect to the 'postgres' database to run a SQL command. --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c7f59aa4514..72b49faa683 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,8 +50,9 @@ jobs: - name: Create Extension Neon env: PGHOST: /tmp + PGDATABASE: postgres run: | - psql -c 'create extension neon;' + psql --echo-queries --command 'create extension neon;' - name: Stop Postgres run: |