Skip to content

Commit 4d544c8

Browse files
committed
Add docker files
1 parent 4563cc3 commit 4d544c8

File tree

4 files changed

+46
-22
lines changed

4 files changed

+46
-22
lines changed

.travis.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,29 @@ dist: trusty
66

77
language: c
88

9-
compiler:
10-
- clang
11-
- gcc
9+
services:
10+
- docker
1211

13-
before_install:
14-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -y install -qq wget ca-certificates; fi
15-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then source ./travis/dep-ubuntu-postgres.sh; fi
16-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then source ./travis/dep-ubuntu-llvm.sh; fi
17-
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi
12+
install:
13+
- sed -e 's/${CC}/'${CC}/g -e 's/${PG_VERSION}/'${PG_VERSION}/g Dockerfile.tmpl > Dockerfile
14+
- docker-compose build
1815

19-
env:
20-
global:
21-
- LLVM_VER=4.0
22-
matrix:
23-
- PG_VER=10 CHECK_CODE=true
24-
- PG_VER=10 CHECK_CODE=false
25-
- PG_VER=9.6 CHECK_CODE=true
26-
- PG_VER=9.6 CHECK_CODE=false
27-
- PG_VER=9.5 CHECK_CODE=true
28-
- PG_VER=9.5 CHECK_CODE=false
16+
script:
17+
- docker-compose run tests
2918

30-
script: bash ./travis/pg-travis-test.sh
19+
env:
20+
- PG_VERSION=10 CHECK_CODE=true CC=clang
21+
- PG_VERSION=10 CHECK_CODE=false CC=clang
22+
- PG_VERSION=9.6 CHECK_CODE=true CC=clang
23+
- PG_VERSION=9.6 CHECK_CODE=false CC=clang
24+
- PG_VERSION=9.5 CHECK_CODE=true CC=clang
25+
- PG_VERSION=9.5 CHECK_CODE=false CC=clang
26+
- PG_VERSION=10 CHECK_CODE=true CC=gcc
27+
- PG_VERSION=10 CHECK_CODE=false CC=gcc
28+
- PG_VERSION=9.6 CHECK_CODE=true CC=gcc
29+
- PG_VERSION=9.6 CHECK_CODE=false CC=gcc
30+
- PG_VERSION=9.5 CHECK_CODE=true CC=gcc
31+
- PG_VERSION=9.5 CHECK_CODE=false CC=gcc
3132

3233
after_success:
3334
- bash <(curl -s https://codecov.io/bash)

Dockerfile.tmpl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM postgres:${PG_VERSION}-alpine
2+
3+
ENV LANG=C.UTF-8
4+
RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.6/main' > /etc/apk/repositories && \
5+
echo 'http://dl-cdn.alpinelinux.org/alpine/v3.6/community' >> /etc/apk/repositories && \
6+
apk --no-cache add cmocka cppcheck cmake python3 gcc make ${CC}
7+
RUN apk add --no-cache musl-dev cmocka-dev
8+
RUN pip3 install testgres
9+
10+
ENV PGDATA=/pg/data
11+
RUN mkdir -p /pg/data && \
12+
mkdir /pg/pg_pathman && \
13+
chown postgres:postgres ${PGDATA} && \
14+
chmod a+rwx /usr/local/lib/postgresql && \
15+
chmod a+rwx /usr/local/share/postgresql/extension
16+
17+
ADD . /pg/pg_pathman
18+
WORKDIR /pg/pg_pathman
19+
RUN chmod -R go+rwX /pg/pg_pathman
20+
USER postgres
21+
RUN PGDATA=${PGDATA} CC=${CC} CHECK_CODE=${CHECK_CODE} bash run_tests.sh

src/utility_stmt_hooking.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@
3131
#include "utils/memutils.h"
3232
#include "utils/rls.h"
3333

34-
#include "libpq/libpq.h"
35-
34+
/* we avoid includig libpq.h because it requires openssl.h */
35+
#include "libpq/pqcomm.h"
36+
extern ProtocolVersion FrontendProtocol;
37+
extern void pq_endmsgread(void);
3638

3739
/* Determine whether we should enable COPY or not (PostgresPro has a fix) */
3840
#if defined(WIN32) && \

travis/pg-travis-test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ CLUSTER_PATH=$(pwd)/test_cluster
6868
$initdb_path -D $CLUSTER_PATH -U $USER -A trust
6969

7070
# build pg_pathman (using CFLAGS_SL for gcov)
71-
make USE_PGXS=1 PG_CONFIG=$config_path CFLAGS_SL="$($config_path --cflags_sl) -coverage"
71+
make USE_PGXS=1 CC=${CC} PG_CONFIG=$config_path CFLAGS_SL="$($config_path --cflags_sl) -coverage"
7272
sudo make install USE_PGXS=1 PG_CONFIG=$config_path
7373

7474
# check build

0 commit comments

Comments
 (0)