Skip to content

Commit 0a3611d

Browse files
committed
Streamline the setup workflow
1 parent 53e6388 commit 0a3611d

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed

.github/workflows/build_and_test.yml

+14-17
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,26 @@ jobs:
77
strategy:
88
matrix:
99
os: [ubuntu-latest]
10-
version: [REL_16_STABLE, REL_17_STABLE]
10+
version: [16, 17]
1111
runs-on: ${{ matrix.os }}
1212

1313
steps:
1414
- name: Test details
15-
run: echo Build and test pljs on ${{ matrix.os }} with PostgreSQL ${{ matrix.version }} branch
15+
run: echo Build and test pljs on ${{ matrix.os }} PostgreSQL version ${{ matrix.version }}
1616

1717
- name: Checkout and build PostgreSQL code
1818
run: |
1919
sudo apt-get update -qq
2020
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
21-
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
22-
rm -rf postgres
23-
git clone --branch ${{ matrix.version }} --single-branch --depth 1 https://github.com/postgres/postgres.git
24-
pushd postgres
25-
git branch
26-
./configure --prefix=$PWD/inst/ --enable-cassert --enable-debug --with-openssl
27-
make -j4 install
28-
21+
sudo apt-get install -y build-essential pkg-config cmake curl ca-certificates
22+
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'
23+
sudo apt update
24+
sudo apt install -y postgresql-${{ matrix.version }} postgresql-server-dev-${{ matrix.version }}
2925
- name: Start Postgres
3026
run: |
31-
pushd postgres
32-
cd inst/bin
33-
./initdb -D data
34-
./pg_ctl -D data -l logfile start
35-
popd
27+
sudo service postgresql start
28+
sudo -u postgres createuser -s runner
29+
ps ax | grep postgres
3630
3731
- name: Checkout pljs extension code
3832
uses: actions/checkout@v4
@@ -42,9 +36,12 @@ jobs:
4236
- name: Build and test pljs extension
4337
id: regression-tests
4438
run: |
45-
export PATH="${PWD}/postgres/inst/bin:$PATH"
39+
export PATH="/usr/lib/postgresql/${{ matrix.version }}/bin/:$PATH"
4640
pushd pljs
47-
make install
41+
make
42+
sudo PATH="/usr/lib/postgresql/${{ matrix.version }}/bin/:$PATH" make install
43+
which pg_config
44+
which psql
4845
make installcheck
4946
popd
5047

Makefile

+7-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: lintcheck format cleandepend cleansql docs clean test all
1+
.PHONY: lintcheck format cleansql docs clean test all
22

33
PLJS_VERSION = 0.8.1
44

@@ -10,7 +10,7 @@ INCLUDEDIR_SERVER := ${shell $(PG_CONFIG) --includedir-server}
1010

1111
CP = cp
1212
SRCS = src/pljs.c src/cache.c src/functions.c src/types.c src/params.c
13-
OBJS = src/pljs.o src/cache.o src/functions.o src/types.o src/params.o deps/quickjs/libquickjs.a
13+
OBJS = src/pljs.o src/cache.o src/functions.o src/types.o src/params.o
1414
MODULE_big = pljs
1515
EXTENSION = pljs
1616
DATA = pljs.control pljs--$(PLJS_VERSION).sql
@@ -21,19 +21,18 @@ REGRESS = init-extension function json jsonb json_conv types bytea context \
2121
cursor array_spread plv8_regressions memory_limits inline composites \
2222
trigger procedure find_function
2323

24-
all: deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql
25-
24+
all: deps/quickjs/quickjs.h deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql
2625

2726
include $(PGXS)
2827

29-
28+
src/pljs.o: deps/quickjs/libquickjs.a
3029

3130
deps/quickjs/quickjs.h:
3231
mkdir -p deps
3332
git submodule update --init --recursive
3433
patch -p1 <patches/01-shared-lib-build
3534

36-
deps/quickjs/libquickjs.a:
35+
deps/quickjs/libquickjs.a: deps/quickjs/quickjs.h
3736
cd deps/quickjs && make
3837

3938
format:
@@ -45,23 +44,12 @@ pljs--$(PLJS_VERSION).sql: pljs.sql
4544
lintcheck:
4645
clang-tidy $(SRCS) -- -I$(INCLUDEDIR) -I$(INCLUDEDIR_SERVER) -I$(PWD) --std=c11
4746

48-
.depend: deps/quickjs/quickjs.h
49-
$(RM) -f .depend
50-
$(foreach SRC,$(SRCS),$(CC) $(PG_CFLAGS) -I$(INCLUDEDIR) -I$(INCLUDEDIR_SERVER) \
51-
-I$(PWD) -MM -MT $(SRC:.c=.o) $(SRC) >> .depend;)
52-
47+
all: deps/quickjs/quickjs.h deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql
5348

54-
all: deps/quickjs/libquickjs.a pljs--$(PLJS_VERSION).sql
55-
56-
clean: cleandepend cleansql
57-
58-
cleandepend:
59-
$(RM) -f .depend
49+
clean: cleansql
6050

6151
cleansql:
6252
$(RM) -f pljs--$(PLJS_VERSION).sql
6353

6454
docs:
6555
doxygen src/Doxyfile
66-
67-
include .depend

0 commit comments

Comments
 (0)