Permalink
Browse files

bug: travis test not use HEAD postgresql (#630)

Previously, Travis jobs that aimed to test HEAD did not use HEAD in fact. This PR brings proper HEAD PG testing and adds contrib into the HEAD testing.
  • Loading branch information...
Gordiychuk authored and vlsi committed Aug 30, 2016
1 parent dd48911 commit 90303734fcdad73bcdfaebcaec13d5e42060a83a
@@ -2,8 +2,10 @@ sudo: false
language: java

before_script:
- test "x$XA" == 'x' || ./.travis/travis_install_dependencies.sh
- test "x$PG_VERSION" != "xHEAD" || ./.travis/travis_install_head_postgres.sh
- export PG_DATADIR="/etc/postgresql/${PG_VERSION}/main"
- ./.travis/travis_install_postgres.sh
- test "x$XA" == 'x' || ./.travis/travis_configure_xa.sh
- ./.travis/travis_start_postgres.sh
- psql -U postgres -c "create user test with password 'test';"
- psql -c 'create database test owner test;' -U postgres
- echo "MAVEN_OPTS='-Xmx1g -Dgpg.skip=true'" > ~/.mavenrc
@@ -88,8 +90,11 @@ matrix:
- MCENTRAL=Y
- JDOC=Y
- jdk: oraclejdk8
sudo: required
dist: trusty
env:
- PG_VERSION=HEAD
- XA=true
- jdk: openjdk7
addons:
postgresql: "9.4"
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -x -e

sudo sed -i -e 's/#max_prepared_transactions = 0/max_prepared_transactions = 64/g' /etc/postgresql/${PG_VERSION}/main/postgresql.conf

This file was deleted.

Oops, something went wrong.
@@ -1,12 +1,27 @@
#!/usr/bin/env bash
set -x -e

sudo service postgresql stop
sudo apt-get remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common -qq --purge
sudo apt-get -y install libxml2

git clone --depth=1 https://github.com/postgres/postgres.git
cd postgres

PREFIX=$HOME/pg_head
# Build PostgreSQL from source
sudo ./configure --with-libxml && sudo make && sudo make install
sudo ln -s /usr/local/pgsql/bin/psql /usr/bin/psql
# Build contrib from source
cd contrib
sudo make all && sudo make install

#Post compile actions
LD_LIBRARY_PATH=/usr/local/pgsql/lib
export LD_LIBRARY_PATH
sudo /sbin/ldconfig /usr/local/pgsql/lib

./configure --prefix=$PREFIX
sudo mkdir -p ${PG_DATADIR}
sudo chmod 777 ${PG_DATADIR}
sudo chown -R postgres:postgres ${PG_DATADIR}

# Build PostgreSQL from source and start the DB
make && make install && $PREFIX/bin/pg_ctl -D $PREFIX/data initdb && $PREFIX/bin/pg_ctl -D $PREFIX/data -l postgres.log start
sudo su postgres -c "/usr/local/pgsql/bin/pg_ctl -D ${PG_DATADIR} -U postgres initdb"
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Adapted from https://github.com/dockyard/reefpoints/blob/master/source/posts/2013-03-29-running-postgresql-9-2-on-travis-ci.md
set -x -e

if [ -z "$PG_VERSION" ]
then
echo "env PG_VERSION not define";
elif [ "${PG_VERSION}" = "HEAD" ]
then
./.travis/travis_install_head_postgres.sh
elif [ ! -d "${PG_DATADIR}" ]
then
sudo cp /etc/postgresql/9.1/main/pg_hba.conf ./
sudo apt-get remove postgresql libpq-dev libpq5 postgresql-client-common postgresql-common -qq --purge
source /etc/lsb-release
echo "deb http://apt.postgresql.org/pub/repos/apt/ $DISTRIB_CODENAME-pgdg main ${PG_VERSION}" > pgdg.list
sudo mv pgdg.list /etc/apt/sources.list.d/
wget --quiet -O - https://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install postgresql-${PG_VERSION} postgresql-contrib-${PG_VERSION} -qq

sudo cp ./pg_hba.conf /etc/postgresql/${PG_VERSION}/main
if [ ${PG_VERSION} = '8.4' ]
then
sudo sed -i -e 's/port = 5433/port = 5432/g' /etc/postgresql/8.4/main/postgresql.conf
fi

sudo service postgresql restart ${PG_VERSION}
sudo tail /var/log/postgresql/postgresql-${PG_VERSION}-main.log
fi
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -x -e

if [ -z "$PG_VERSION" ]
then
echo "env PG_VERSION not define";
elif [ "x${PG_VERSION}" = "xHEAD" ]
then
#Start head postgres
sudo su postgres -c "/usr/local/pgsql/bin/pg_ctl -D ${PG_DATADIR} -w -t 300 -o '-p 5432' -l /tmp/postgres.log start"
sudo tail /tmp/postgres.log
elif [ "$XA" = "true" ]
then
sudo service postgresql stop
sudo service postgresql start ${PG_VERSION}
sudo tail /var/log/postgresql/postgresql-${PG_VERSION}-main.log
fi

0 comments on commit 9030373

Please sign in to comment.