File tree Expand file tree Collapse file tree 7 files changed +112
-0
lines changed Expand file tree Collapse file tree 7 files changed +112
-0
lines changed Original file line number Diff line number Diff line change 1+ * .gcno
2+ * .gcda
3+ * .gcov
4+ * .so
Original file line number Diff line number Diff line change @@ -38,3 +38,5 @@ lib*.pc
3838/Debug /
3939/Release /
4040/tmp_install /
41+
42+ Dockerfile
Original file line number Diff line number Diff line change 1+ sudo : required
2+
3+ language : c
4+
5+ services :
6+ - docker
7+
8+ install :
9+ - ./mk_dockerfile.sh
10+ - docker-compose build
11+
12+ script :
13+ - docker-compose run $(bash <(curl -s https://codecov.io/env)) tests
14+
15+ notifications :
16+ email :
17+ on_success : change
18+ on_failure : always
19+
20+ env :
21+ - PG_VERSION=10
22+ - PG_VERSION=9.6
23+ - PG_VERSION=9.5
Original file line number Diff line number Diff line change 1+ FROM postgres:${PG_VERSION}-alpine
2+
3+ # Install dependencies
4+ RUN apk add --no-cache clang-analyzer clang perl make musl-dev gcc curl;
5+
6+ # Environment
7+ ENV LANG=C.UTF-8 PGDATA=/pg/data
8+
9+ # Make directories
10+ RUN mkdir -p ${PGDATA} && \
11+ mkdir -p /pg/testdir
12+
13+ # Grant privileges
14+ RUN chown postgres:postgres ${PGDATA} && \
15+ chown postgres:postgres /pg/testdir && \
16+ chmod a+rwx /usr/local/lib/postgresql && \
17+ chmod a+rwx /usr/local/share/postgresql/extension
18+
19+ COPY run_tests.sh /run.sh
20+ RUN chmod 755 /run.sh
21+
22+ ADD . /pg/testdir
23+ WORKDIR /pg/testdir
24+
25+ USER postgres
26+ ENTRYPOINT /run.sh
Original file line number Diff line number Diff line change 1+ tests :
2+ build : .
Original file line number Diff line number Diff line change 1+ set -eu
2+ sed -e ' s/${PG_VERSION}/' ${PG_VERSION} /g Dockerfile.tmpl > Dockerfile
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ # Copyright (c) 2018, Postgres Professional
4+
5+
6+ set -ux
7+
8+
9+ status=0
10+
11+ # perform static analyzis
12+ scan-build --status-bugs make USE_PGXS=1 || status=$?
13+
14+ # something's wrong, exit now!
15+ if [ $status -ne 0 ]; then exit 1; fi
16+
17+ # don't forget to "make clean"
18+ make USE_PGXS=1 clean
19+
20+ # initialize database
21+ initdb -D $PGDATA
22+
23+ # build and install extension (using PG_CPPFLAGS and SHLIB_LINK for gcov)
24+ make USE_PGXS=1 PG_CPPFLAGS=" -coverage" SHLIB_LINK=" -coverage"
25+ make USE_PGXS=1 install
26+
27+ # restart cluster 'test'
28+ echo " port = 55435" >> $PGDATA /postgresql.conf
29+ pg_ctl start -l /tmp/postgres.log -w || status=$?
30+
31+ # something's wrong, exit now!
32+ if [ $status -ne 0 ]; then cat /tmp/postgres.log; exit 1; fi
33+
34+ # run regression tests
35+ export PG_REGRESS_DIFF_OPTS=" -w -U3" # for alpine's diff (BusyBox)
36+ PGPORT=55435 make USE_PGXS=1 installcheck || status=$?
37+
38+ # show diff if it exists
39+ if test -f regression.diffs; then cat regression.diffs; fi
40+
41+ # something's wrong, exit now!
42+ if [ $status -ne 0 ]; then exit 1; fi
43+
44+ # generate *.gcov files
45+ rm -f * serialize.{gcda,gcno}
46+ gcov * .c * .h
47+
48+
49+ set +ux
50+
51+
52+ # send coverage stats to Codecov
53+ bash <( curl -s https://codecov.io/bash)
You can’t perform that action at this time.
0 commit comments