From 3372714a66ccb1e5c1c6a84a2e1ef05f4c303a00 Mon Sep 17 00:00:00 2001 From: Jason Petersen Date: Wed, 13 Mar 2024 13:26:31 -0600 Subject: [PATCH] Enable CI tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Caught some issues around install scripts and use of PostgreSQL 16–only features. Merging with failures and fixing soon. --- .github/workflows/installcheck.yml | 54 +++++++++++++++++++++++++++++ .github/workflows/trunk_publish.yml | 4 +-- .gitignore | 5 +++ Makefile | 14 ++++++-- sql/timeseries--0.1.0--0.1.1.sql | 1 + 5 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/installcheck.yml create mode 100644 .gitignore create mode 100644 sql/timeseries--0.1.0--0.1.1.sql diff --git a/.github/workflows/installcheck.yml b/.github/workflows/installcheck.yml new file mode 100644 index 0000000..4e03148 --- /dev/null +++ b/.github/workflows/installcheck.yml @@ -0,0 +1,54 @@ +name: PostgreSQL Installcheck + +on: + pull_request: + types: [opened, edited, reopened, review_requested] + +jobs: + installcheck: + strategy: + matrix: + pg_version: [14, 15, 16] + os: [ubuntu-latest] + + runs-on: ${{matrix.os}} + steps: + - name: Add PGDG repo + run: > + sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && + sudo sh -c 'wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg' && + sudo apt-get update + + - name: Install/modify postgresql-common + run: > + sudo apt-get install -y --no-install-recommends postgresql-common && + sudo sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf + + - name: Install PostgreSQL and server-dev + run: > + sudo apt-get install -y --no-install-recommends \ + postgresql-${{matrix.pg_version}} \ + postgresql-server-dev-${{matrix.pg_version}} + + - name: Install dependencies + run: > + sudo apt-get install -y --no-install-recommends \ + postgresql-${{matrix.pg_version}}-partman + + - uses: actions/checkout@v3 + + - name: Install extension + run: sudo make install + + - name: Start PostgreSQL + run: > + sudo pg_dropcluster 14 main && + sudo pg_createcluster ${{matrix.pg_version}} main --start -- -A trust + + - name: Test extension + id: installcheck + run: PGUSER=postgres PGCLUSTER=${{matrix.pg_version}}/main make installcheck + + - name: Display results + if: failure() && steps.installcheck.outcome != 'success' + run: cat regression.diffs diff --git a/.github/workflows/trunk_publish.yml b/.github/workflows/trunk_publish.yml index 27617c9..c596152 100644 --- a/.github/workflows/trunk_publish.yml +++ b/.github/workflows/trunk_publish.yml @@ -10,12 +10,12 @@ on: branches: - main paths-ignore: - - 'README.md' + - "README.md" push: branches: - main paths-ignore: - - 'README.md' + - "README.md" release: types: diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ff3c3eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +results/ + +# ignore latest install file +timeseries--?.?.?.sql +!timeseries--?.?.?--?.?.?.sql diff --git a/Makefile b/Makefile index fe08fd7..12c7757 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,11 @@ EXTVERSION = $(shell grep -m 1 '[[:space:]]\{8\}"version":' META.json | \ DISTVERSION = $(shell grep -m 1 '[[:space:]]\{3\}"version":' META.json | \ sed -e 's/[[:space:]]*"version":[[:space:]]*"\([^"]*\)",\{0,1\}/\1/') +EXTVERSIONS = 0.1.0 0.1.1 + DATA = $(wildcard sql/*--*.sql) +DATA_built = $(foreach v,$(EXTVERSIONS),sql/$(EXTENSION)--$(v).sql) + DOCS = $(wildcard doc/*.md) TESTS = $(wildcard test/sql/*.sql) REGRESS = $(patsubst test/sql/%.sql,%,$(TESTS)) @@ -18,11 +22,15 @@ include $(PGXS) all: sql/$(EXTENSION)--$(EXTVERSION).sql -sql/$(EXTENSION)--$(EXTVERSION).sql: sql/$(EXTENSION).sql - cp $< $@ - dist: git archive --format zip --prefix=$(EXTENSION)-$(DISTVERSION)/ -o $(EXTENSION)-$(DISTVERSION).zip HEAD latest-changes.md: Changes perl -e 'while (<>) {last if /^(v?\Q${DISTVERSION}\E)/; } print "Changes for v${DISTVERSION}:\n"; while (<>) { last if /^\s*$$/; s/^\s+//; print }' Changes > $@ + +# generate each version's file installation file by concatenating +# previous upgrade scripts +sql/$(EXTENSION)--0.1.0.sql: sql/$(EXTENSION).sql + cat $^ > $@ +sql/$(EXTENSION)--0.1.1.sql: sql/$(EXTENSION)--0.1.0.sql sql/$(EXTENSION)--0.1.0--0.1.1.sql + cat $^ > $@ diff --git a/sql/timeseries--0.1.0--0.1.1.sql b/sql/timeseries--0.1.0--0.1.1.sql new file mode 100644 index 0000000..9d9e7af --- /dev/null +++ b/sql/timeseries--0.1.0--0.1.1.sql @@ -0,0 +1 @@ +-- empty upgrade, version number only