From 0a3611de01623a504b021594f4e227352da24f73 Mon Sep 17 00:00:00 2001 From: Jerry Sievert Date: Thu, 7 Nov 2024 20:46:05 -0800 Subject: [PATCH] Streamline the setup workflow --- .github/workflows/build_and_test.yml | 31 +++++++++++++--------------- Makefile | 26 +++++++---------------- 2 files changed, 21 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index bc16d17..e6f9f70 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -7,32 +7,26 @@ jobs: strategy: matrix: os: [ubuntu-latest] - version: [REL_16_STABLE, REL_17_STABLE] + version: [16, 17] runs-on: ${{ matrix.os }} steps: - name: Test details - run: echo Build and test pljs on ${{ matrix.os }} with PostgreSQL ${{ matrix.version }} branch + run: echo Build and test pljs on ${{ matrix.os }} PostgreSQL version ${{ matrix.version }} - name: Checkout and build PostgreSQL code run: | sudo apt-get update -qq sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 - sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config libc++-dev libc++abi-dev libglib2.0-dev libtinfo6 cmake libstdc++-12-dev - rm -rf postgres - git clone --branch ${{ matrix.version }} --single-branch --depth 1 https://github.com/postgres/postgres.git - pushd postgres - git branch - ./configure --prefix=$PWD/inst/ --enable-cassert --enable-debug --with-openssl - make -j4 install - + sudo apt-get install -y build-essential pkg-config cmake curl ca-certificates + sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' + sudo apt update + sudo apt install -y postgresql-${{ matrix.version }} postgresql-server-dev-${{ matrix.version }} - name: Start Postgres run: | - pushd postgres - cd inst/bin - ./initdb -D data - ./pg_ctl -D data -l logfile start - popd + sudo service postgresql start + sudo -u postgres createuser -s runner + ps ax | grep postgres - name: Checkout pljs extension code uses: actions/checkout@v4 @@ -42,9 +36,12 @@ jobs: - name: Build and test pljs extension id: regression-tests run: | - export PATH="${PWD}/postgres/inst/bin:$PATH" + export PATH="/usr/lib/postgresql/${{ matrix.version }}/bin/:$PATH" pushd pljs - make install + make + sudo PATH="/usr/lib/postgresql/${{ matrix.version }}/bin/:$PATH" make install + which pg_config + which psql make installcheck popd diff --git a/Makefile b/Makefile index c2b7a80..8293dfc 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: lintcheck format cleandepend cleansql docs clean test all +.PHONY: lintcheck format cleansql docs clean test all PLJS_VERSION = 0.8.1 @@ -10,7 +10,7 @@ INCLUDEDIR_SERVER := ${shell $(PG_CONFIG) --includedir-server} CP = cp SRCS = src/pljs.c src/cache.c src/functions.c src/types.c src/params.c -OBJS = src/pljs.o src/cache.o src/functions.o src/types.o src/params.o deps/quickjs/libquickjs.a +OBJS = src/pljs.o src/cache.o src/functions.o src/types.o src/params.o MODULE_big = pljs EXTENSION = pljs DATA = pljs.control pljs--$(PLJS_VERSION).sql @@ -21,19 +21,18 @@ REGRESS = init-extension function json jsonb json_conv types bytea context \ cursor array_spread plv8_regressions memory_limits inline composites \ trigger procedure find_function -all: deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql - +all: deps/quickjs/quickjs.h deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql include $(PGXS) - +src/pljs.o: deps/quickjs/libquickjs.a deps/quickjs/quickjs.h: mkdir -p deps git submodule update --init --recursive patch -p1 > .depend;) - +all: deps/quickjs/quickjs.h deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql -all: deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql - -clean: cleandepend cleansql - -cleandepend: - $(RM) -f .depend +clean: cleansql cleansql: $(RM) -f pljs--$(PLJS_VERSION).sql docs: doxygen src/Doxyfile - -include .depend