Skip to content

Commit 2133015

Browse files
committed
update test environment (Docker etc)
1 parent 1608d8d commit 2133015

File tree

6 files changed

+200
-231
lines changed

6 files changed

+200
-231
lines changed

.dockerignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.gcno
2+
*.gcda
3+
*.gcov
4+
*.so
5+
*.o

.travis.yml

+17-13
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
os:
2-
- linux
3-
41
sudo: required
5-
dist: trusty
62

73
language: c
84

95
services:
106
- docker
117

128
install:
13-
- echo "FROM ${DOCKER_IMAGE}" > Dockerfile
9+
- ./mk_dockerfile.sh
1410
- docker-compose build
1511

1612
script:
1713
- docker-compose run $(bash <(curl -s https://codecov.io/env)) tests
1814

15+
notifications:
16+
email:
17+
on_success: change
18+
on_failure: always
19+
1920
env:
20-
- DOCKER_IMAGE=pathman/pg95_clang_check_code
21-
- DOCKER_IMAGE=pathman/pg95_pathman_tests
22-
- DOCKER_IMAGE=pathman/pg96_clang_check_code
23-
- DOCKER_IMAGE=pathman/pg96_pathman_tests
24-
- DOCKER_IMAGE=pathman/pg10_clang_check_code
25-
- DOCKER_IMAGE=pathman/pg10_pathman_tests
26-
- DOCKER_IMAGE=pathman/pg10_ca_clang_check_code
27-
- DOCKER_IMAGE=pathman/pg10_ca_pathman_tests
21+
- PG_VERSION=10 LEVEL=nightmare
22+
- PG_VERSION=10 LEVEL=hardcore
23+
- PG_VERSION=10
24+
- PG_VERSION=9.6 LEVEL=hardcore
25+
- PG_VERSION=9.6
26+
- PG_VERSION=9.5 LEVEL=hardcore
27+
- PG_VERSION=9.5
28+
29+
matrix:
30+
allow_failures:
31+
- env: PG_VERSION=10 LEVEL=nightmare

Dockerfile.tmpl

+32-22
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,40 @@
1-
FROM ${PG_IMAGE}
1+
FROM postgres:${PG_VERSION}-alpine
22

3-
ENV LANG=C.UTF-8 PGDATA=/pg/data
3+
# Install dependencies
4+
RUN apk add --no-cache \
5+
openssl curl \
6+
cmocka-dev \
7+
perl perl-ipc-run \
8+
python3 python3-dev py-virtualenv \
9+
coreutils linux-headers \
10+
make musl-dev gcc bison flex \
11+
zlib-dev libedit-dev \
12+
clang clang-analyzer;
13+
14+
# Install fresh valgrind
15+
RUN apk add valgrind \
16+
--update-cache \
17+
--repository http://dl-3.alpinelinux.org/alpine/edge/main;
418

5-
RUN if [ "${CHECK_CODE}" = "clang" ] ; then \
6-
echo 'http://dl-3.alpinelinux.org/alpine/edge/main' > /etc/apk/repositories; \
7-
apk --no-cache add clang-analyzer make musl-dev gcc; \
8-
fi
19+
# Environment
20+
ENV LANG=C.UTF-8 PGDATA=/pg/data
921

10-
RUN if [ "${CHECK_CODE}" = "cppcheck" ] ; then \
11-
apk --no-cache add cppcheck --repository http://dl-cdn.alpinelinux.org/alpine/v3.6/community; \
12-
fi
22+
# Make directories
23+
RUN mkdir -p ${PGDATA} && \
24+
mkdir -p /pg/testdir
1325

14-
RUN if [ "${CHECK_CODE}" = "false" ] ; then \
15-
echo 'http://dl-3.alpinelinux.org/alpine/edge/main' > /etc/apk/repositories; \
16-
apk --no-cache add curl python3 python3-dev gcc make musl-dev cmocka-dev linux-headers;\
17-
pip3 install virtualenv;\
18-
fi
26+
# Add data to test dir
27+
ADD . /pg/testdir
1928

20-
RUN mkdir -p /pg/data && \
21-
mkdir /pg/pg_pathman && \
22-
chown postgres:postgres ${PGDATA} && \
29+
# Grant privileges
30+
RUN chown -R postgres:postgres ${PGDATA} && \
31+
chown -R postgres:postgres /pg/testdir && \
2332
chmod a+rwx /usr/local/lib/postgresql && \
2433
chmod a+rwx /usr/local/share/postgresql/extension
2534

26-
ONBUILD ADD . /pg/pg_pathman
27-
ONBUILD WORKDIR /pg/pg_pathman
28-
ONBUILD RUN chmod -R go+rwX /pg/pg_pathman
29-
ONBUILD USER postgres
30-
ONBUILD ENTRYPOINT PGDATA=${PGDATA} CHECK_CODE=${CHECK_CODE} bash run_tests.sh
35+
COPY run_tests.sh /run.sh
36+
RUN chmod 755 /run.sh
37+
38+
USER postgres
39+
WORKDIR /pg/testdir
40+
ENTRYPOINT LEVEL=${LEVEL} /run.sh

make_images.py

-139
This file was deleted.

mk_dockerfile.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
if [ -z ${PG_VERSION+x} ]; then
2+
echo PG_VERSION is not set!
3+
exit 1
4+
fi
5+
6+
if [ -z ${LEVEL+x} ]; then
7+
LEVEL=scan-build
8+
fi
9+
10+
echo PG_VERSION=${PG_VERSION}
11+
echo LEVEL=${LEVEL}
12+
13+
sed \
14+
-e 's/${PG_VERSION}/'${PG_VERSION}/g \
15+
-e 's/${LEVEL}/'${LEVEL}/g \
16+
Dockerfile.tmpl > Dockerfile

0 commit comments

Comments
 (0)