From 2a9ca7977286a899428a20f368b3dd34710123e6 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sat, 25 Mar 2017 22:52:40 +0000 Subject: [PATCH] Added travis configuration for CI tests --- .travis.yml | 22 ++++++++++++++++++++++ README.rst | 6 ++++++ regress/travis_prepare.sh | 29 +++++++++++++++++++++++++++++ regress/travis_test.sh | 10 ++++++++++ 4 files changed, 67 insertions(+) create mode 100644 .travis.yml create mode 100755 regress/travis_prepare.sh create mode 100755 regress/travis_test.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f2d00dc --- /dev/null +++ b/.travis.yml @@ -0,0 +1,22 @@ +# Travis CI configuration file for psycopg2 + +dist: trusty +sudo: required + +env: + - PGVER=9.6 + - PGVER=9.5 + - PGVER=9.4 + - PGVER=9.3 + - PGVER=9.2 + +install: + - source regress/travis_prepare.sh + - make + - sudo make install + +script: + - regress/travis_test.sh + +notifications: + email: false diff --git a/README.rst b/README.rst index c5299be..c39afd8 100644 --- a/README.rst +++ b/README.rst @@ -7,6 +7,12 @@ pg_repack -- Reorganize tables in PostgreSQL databases with minimal locks - Bug Report: https://github.com/reorg/pg_repack/issues - Mailing List: http://pgfoundry.org/mailman/listinfo/reorg-general +|travis| + +.. |travis| image:: https://travis-ci.org/reorg/pg_repack.svg?branch=master + :target: https://travis-ci.org/reorg/pg_repack + :alt: Linux and OSX build status + pg_repack_ is a PostgreSQL extension which lets you remove bloat from tables and indexes, and optionally restore the physical order of clustered indexes. Unlike CLUSTER_ and `VACUUM FULL`_ it works online, without diff --git a/regress/travis_prepare.sh b/regress/travis_prepare.sh new file mode 100755 index 0000000..d34ff55 --- /dev/null +++ b/regress/travis_prepare.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -e -x + +export PACKAGE="$PGVER" +export PGDIR="/usr/lib/postgresql/$PACKAGE" +export CONFDIR="/etc/postgresql/$PACKAGE/main" +export DATADIR="/var/lib/postgresql/$PACKAGE/main" +export PGBIN="$PGDIR/bin" +export PATH="$PGBIN:$PATH" + +# Match libpq and server-dev packages +# See https://github.com/reorg/pg_repack/issues/63 +sudo sed -i "s/main[[:space:]]*$/main ${PGVER}/" \ + /etc/apt/sources.list.d/pgdg.list +sudo apt-get update +sudo apt-get remove -y libpq5 +sudo apt-get install -y "libpq5=${PGVER}*" "libpq-dev=${PGVER}*" +sudo apt-mark hold libpq5 +sudo apt-get install -y postgresql-server-dev-$PGVER postgresql-$PGVER + +# Go somewhere else or sudo will fail +cd / +# Already started because of installing posgresql-$PGVER +# sudo -u postgres "$PGBIN/pg_ctl" -w -l /dev/null -D "$CONFDIR" start +sudo -u postgres mkdir -p /var/lib/postgresql/testts +sudo -u postgres "$PGBIN/psql" \ + -c "create tablespace testts location '/var/lib/postgresql/testts'" +cd - diff --git a/regress/travis_test.sh b/regress/travis_test.sh new file mode 100755 index 0000000..763a705 --- /dev/null +++ b/regress/travis_test.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -x + +export PG_REGRESS_DIFF_OPTS=-u + +if ! make installcheck; then + cat regress/regression.diffs + exit 1 +fi