File tree Expand file tree Collapse file tree 7 files changed +62
-26
lines changed Expand file tree Collapse file tree 7 files changed +62
-26
lines changed Original file line number Diff line number Diff line change 1
- name : Tests
1
+ name : Tests on PG11
2
2
3
3
on : [push]
4
4
11
11
steps :
12
12
- uses : actions/checkout@v2
13
13
- name : Build and run tests in Docker
14
- run : env USE_DOCKER=1 ./build-and-test.sh
14
+ run : env USE_DOCKER=1 POSTGRES_VERSION=11 ./build-and-test.sh
Original file line number Diff line number Diff line change
1
+ name : Tests on PG12
2
+
3
+ on : [push]
4
+
5
+ jobs :
6
+
7
+ build :
8
+
9
+ runs-on : ubuntu-18.04
10
+
11
+ steps :
12
+ - uses : actions/checkout@v2
13
+ - name : Build and run tests in Docker
14
+ run : env USE_DOCKER=1 POSTGRES_VERSION=12 ./build-and-test.sh
Original file line number Diff line number Diff line change 1
1
FROM ubuntu:18.04
2
2
3
- ARG POSTGRES_VERSION=11
4
-
5
3
RUN apt-get update \
6
4
&& apt-get install -y curl gnupg2 \
7
5
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
8
6
&& curl -sL https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
9
7
&& apt-get update \
10
8
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
11
- build-essential \
12
- postgresql-${POSTGRES_VERSION} \
13
- postgresql-server-dev-${POSTGRES_VERSION} \
14
- ruby \
15
- sudo \
9
+ build-essential \
10
+ ruby \
11
+ sudo \
16
12
&& apt-get clean \
17
13
&& rm -Rf /var/lib/apt/lists/*
18
14
19
- RUN sudo /etc/init.d/postgresql restart \
20
- && sudo -u postgres createuser -s root
15
+ # Compiling the protobuf library is quite slow, so do this before installing the correct Postgres version
16
+ COPY build-protobuf-library.sh /app/
17
+ RUN /app/build-protobuf-library.sh
18
+
19
+ ARG POSTGRES_VERSION=11
21
20
22
- COPY Makefile /app/
23
- RUN make -C app protoc
21
+ RUN apt-get update \
22
+ && DEBIAN_FRONTEND=noninteractive apt-get install -y \
23
+ postgresql-${POSTGRES_VERSION} \
24
+ postgresql-server-dev-${POSTGRES_VERSION} \
25
+ && apt-get clean \
26
+ && rm -Rf /var/lib/apt/lists/* \
27
+ && /etc/init.d/postgresql restart \
28
+ && sudo -u postgres createuser -s root
24
29
25
- COPY *.hpp *.cpp *.rb *.sh *.sql *.control *.md /app/
26
30
COPY /test_protos /app/test_protos
31
+ COPY Makefile *.hpp *.cpp *.rb *.sh *.sql *.control *.md /app/
Original file line number Diff line number Diff line change 1
1
2
- PROTOBUF_VERSION =3.11.2
3
- PROTOBUF_ROOT =third_party/protobuf- $( PROTOBUF_VERSION )
2
+
3
+ PROTOBUF_ROOT =third_party/protobuf
4
4
PROTOC =$(PROTOBUF_ROOT ) /src/protoc
5
5
6
6
MODULE_big = postgres_protobuf
@@ -33,18 +33,15 @@ clean: pb_clean
33
33
34
34
protoc : $(PROTOC )
35
35
36
- # Hack to get protobuf headers before building any of our stuff
36
+ # Hack to get protobuf headers and libraries before building any of our stuff
37
37
$(OBJS ) $(BC_FILES ) : $(PROTOC )
38
38
39
39
# Instead of proper dependency tracking, it's easier to make all compilation units depend on all headers.
40
40
# Good enough for a small project.
41
41
$(OBJS ) $(BC_FILES ) : $(wildcard * .hpp)
42
42
43
43
$(PROTOC ) :
44
- rm -Rf third_party/protobuf-*
45
- mkdir -p third_party/
46
- cd third_party && curl -L " https://github.com/protocolbuffers/protobuf/releases/download/v$( PROTOBUF_VERSION) /protobuf-cpp-$( PROTOBUF_VERSION) .tar.gz" | tar xzf -
47
- cd third_party/protobuf-$(PROTOBUF_VERSION ) && ./configure --with-pic --enable-static && make -j16
44
+ ./build-protobuf-library.sh
48
45
49
46
sql/postgres_protobuf.sql : generate_test_cases.rb $(DESC_SET_FILES )
50
47
env PROTOC=$(PROTOC ) ./generate_test_cases.rb sql
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ which means that field renames will break backwards- and forwards-compatibility.
32
32
33
33
## Installation
34
34
35
+ Requires Postgres 11 or newer.
36
+
35
37
Prerequisites for installing from source:
36
38
37
39
- Postgres server headers (if you use the Postgres APT repo, install ` postgresql-server-dev-$VERSION ` )
Original file line number Diff line number Diff line change @@ -3,17 +3,20 @@ set -euxo pipefail
3
3
4
4
cd " $( dirname " ${0} " ) "
5
5
6
- if [ -n " ${USE_DOCKER:- } " ]; then
7
- docker build -f Dockerfile.test -t postgres-protobuf-test .
8
- docker run postgres-protobuf-test env __IN_DOCKER=1 /app/build-and-test.sh
6
+ POSTGRES_VERSION=${POSTGRES_VERSION:- 11}
7
+
8
+ if [[ -n " ${USE_DOCKER:- } " ]]; then
9
+ unset USE_DOCKER
10
+ docker build -f Dockerfile.test --build-arg=POSTGRES_VERSION=" ${POSTGRES_VERSION} " -t postgres-protobuf-test:" ${POSTGRES_VERSION} " .
11
+ docker run postgres-protobuf-test:" ${POSTGRES_VERSION} " env __IN_DOCKER=1 /app/build-and-test.sh
9
12
exit $?
10
13
fi
11
14
12
- if [ -n " ${__IN_DOCKER:- } " ]; then
15
+ if [[ -n " ${__IN_DOCKER:- } " ] ]; then
13
16
sudo /etc/init.d/postgresql restart
14
17
fi
15
18
16
- if [ -z " ${NO_CLEAN:- } " ]; then
19
+ if [[ -z " ${NO_CLEAN:- } " ] ]; then
17
20
make clean
18
21
fi
19
22
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ set -euxo pipefail
3
+
4
+ PROTOBUF_VERSION=3.11.2
5
+
6
+ cd " $( dirname " ${0} " ) "
7
+
8
+ rm -Rf third_party/protobuf-*
9
+ mkdir -p third_party/
10
+ cd third_party
11
+ curl -L " https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION} /protobuf-cpp-${PROTOBUF_VERSION} .tar.gz" | tar xzf -
12
+ mv protobuf-" ${PROTOBUF_VERSION} " protobuf
13
+ cd protobuf
14
+ ./configure --with-pic --enable-static
15
+ make -j16
You can’t perform that action at this time.
0 commit comments