From: Chris Wright Date: Tue, 16 Dec 2014 15:35:46 +0000 (+0000) Subject: Improve Travis setup X-Git-Tag: v0.6.0RC1~17 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-pq;a=commitdiff_plain;h=e7ce3fd45d17058f92ce219a34e560226cf72231 Improve Travis setup --- diff --git a/.travis.yml b/.travis.yml index 296407f..aa43ef0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,15 +3,31 @@ language: c addons: postgresql: "9.3" +env: + global: + - BUILD_SRC_DIR=/src + - BUILD_INSTALL_DIR=/install + - PHP_EXTENSIONS="--enable-json --with-mhash" + - PG_TEST_DB_NAME=pq_test + - PG_TEST_DB_USER=postgres + - REPORT_EXIT_STATUS=1 + matrix: + - PHP_TARGET_REF=PHP-5.4 PHP_CONFIGURE_OPTS="" + - PHP_TARGET_REF=PHP-5.4 PHP_CONFIGURE_OPTS="--enable-maintainer-zts" + - PHP_TARGET_REF=PHP-5.5 PHP_CONFIGURE_OPTS="" + - PHP_TARGET_REF=PHP-5.5 PHP_CONFIGURE_OPTS="--enable-maintainer-zts" + - PHP_TARGET_REF=PHP-5.6 PHP_CONFIGURE_OPTS="" + - PHP_TARGET_REF=PHP-5.6 PHP_CONFIGURE_OPTS="--enable-maintainer-zts" + before_install: - sudo apt-get update -qq - sudo apt-get install -qq libpq-dev before_script: - - sudo ./travis/compile-php.sh - - sudo ./travis/compile-raphf.sh - - sudo ./travis/compile-ext.sh - - sudo ./travis/configure-postgres.sh + - ./travis/compile-php.sh + - ./travis/compile-ext-raphf.sh + - ./travis/compile-ext-pq.sh + - ./travis/configure-postgres.sh script: - - REPORT_EXIT_STATUS=1 $HOME/bin/php ./run-tests.php -p $HOME/bin/php --show-diff + - $HOME$BUILD_INSTALL_DIR/bin/php ./run-tests.php -q -p $HOME$BUILD_INSTALL_DIR/bin/php --show-diff diff --git a/travis/compile-ext-pq.sh b/travis/compile-ext-pq.sh new file mode 100755 index 0000000..a7813fe --- /dev/null +++ b/travis/compile-ext-pq.sh @@ -0,0 +1,10 @@ +#!/bin/sh -x + +set -e + +$HOME$BUILD_INSTALL_DIR/bin/phpize +./configure --with-php-config=$HOME$BUILD_INSTALL_DIR/bin/php-config --with-pq + +make -j2 --quiet install + +echo 'extension=pq.so' > $HOME$BUILD_INSTALL_DIR/conf.d/20-pq.ini diff --git a/travis/compile-ext-raphf.sh b/travis/compile-ext-raphf.sh new file mode 100755 index 0000000..2b2f013 --- /dev/null +++ b/travis/compile-ext-raphf.sh @@ -0,0 +1,13 @@ +#!/bin/sh -x + +set -e + +git clone --depth 1 https://github.com/php/pecl-php-raphf $HOME$BUILD_SRC_DIR/raphf +cd $HOME$BUILD_SRC_DIR/raphf + +$HOME$BUILD_INSTALL_DIR/bin/phpize +./configure --with-php-config=$HOME$BUILD_INSTALL_DIR/bin/php-config --enable-raphf + +make -j2 --quiet install + +echo 'extension=raphf.so' > $HOME$BUILD_INSTALL_DIR/conf.d/10-raphf.ini diff --git a/travis/compile-ext.sh b/travis/compile-ext.sh deleted file mode 100755 index 17b6be8..0000000 --- a/travis/compile-ext.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -x - -set -e - -$HOME/bin/phpize -./configure --with-php-config=$HOME/bin/php-config --with-pq - -make -j2 --quiet install - -echo 'extension=pq.so' > $HOME/php.d/20-pq.ini diff --git a/travis/compile-php.sh b/travis/compile-php.sh index 63c8142..83b0537 100755 --- a/travis/compile-php.sh +++ b/travis/compile-php.sh @@ -1,14 +1,19 @@ #!/bin/sh -x set -e -TARGET_PHP_REF="PHP-5.6" -mkdir -p $HOME/php -mkdir -p $HOME/php.d -git clone --depth=1 --branch=$TARGET_PHP_REF https://github.com/php/php-src $HOME/php/src +mkdir -p $HOME$BUILD_SRC_DIR +mkdir -p $HOME$BUILD_INSTALL_DIR/conf.d -cd $HOME/php/src +git clone --depth=1 --branch=$PHP_TARGET_REF https://github.com/php/php-src $HOME$BUILD_SRC_DIR/php-src + +cd $HOME$BUILD_SRC_DIR/php-src ./buildconf --force -./configure --prefix=$HOME --with-config-file-scan-dir=$HOME/php.d --disable-all --enable-maintainer-zts --enable-json --with-mhash +./configure --quiet \ + --prefix=$HOME$BUILD_INSTALL_DIR \ + --with-config-file-scan-dir=$HOME$BUILD_INSTALL_DIR/conf.d \ + --disable-all \ + $PHP_CONFIGURE_OPTS \ + $PHP_EXTENSIONS make -j2 --quiet install diff --git a/travis/compile-raphf.sh b/travis/compile-raphf.sh deleted file mode 100755 index 99aa4b0..0000000 --- a/travis/compile-raphf.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -x - -set -e - -git clone --depth 1 https://github.com/php/pecl-php-raphf $HOME/raphf -cd $HOME/raphf - -$HOME/bin/phpize -./configure --with-php-config=$HOME/bin/php-config --with-pq - -make -j2 --quiet install - -echo 'extension=raphf.so' > $HOME/php.d/10-raphf.ini diff --git a/travis/configure-postgres.sh b/travis/configure-postgres.sh index de5355c..09a41e2 100755 --- a/travis/configure-postgres.sh +++ b/travis/configure-postgres.sh @@ -1,4 +1,7 @@ #!/bin/sh -x -psql -c 'create database pq_test;' -U postgres -echo ' ./tests/_setup.inc +PQ_CREATE_DB_SQL="CREATE DATABASE $PG_TEST_DB_NAME;" +PQ_DSN="postgres://$PG_TEST_DB_USER@localhost/$PG_TEST_DB_NAME" + +psql -c "$PQ_CREATE_DB_SQL" -U $PG_TEST_DB_USER +echo " ./tests/_setup.inc