Improve Travis setup
authorChris Wright <daverandom@php.net>
Tue, 16 Dec 2014 15:35:46 +0000 (15:35 +0000)
committerChris Wright <daverandom@php.net>
Tue, 16 Dec 2014 17:15:33 +0000 (17:15 +0000)
.travis.yml
travis/compile-ext-pq.sh [new file with mode: 0755]
travis/compile-ext-raphf.sh [new file with mode: 0755]
travis/compile-ext.sh [deleted file]
travis/compile-php.sh
travis/compile-raphf.sh [deleted file]
travis/configure-postgres.sh

index 296407fdd26b5af678deec232b2c30f393ef87dc..aa43ef0cd7e56bc102d2dfce5df993d2af26c159 100644 (file)
@@ -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 (executable)
index 0000000..a7813fe
--- /dev/null
@@ -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 (executable)
index 0000000..2b2f013
--- /dev/null
@@ -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 (executable)
index 17b6be8..0000000
+++ /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
index 63c8142a7dbe0ef94dbe68bdae487dd56448f6fb..83b05371d8f48cfc1612bd7eb8290d696a9573dd 100755 (executable)
@@ -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 (executable)
index 99aa4b0..0000000
+++ /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
index de5355ce9b2e90499bcbe2f8649d0b2d89f48e16..09a41e24ea67651a546091dcbc8415ca2947ff78 100755 (executable)
@@ -1,4 +1,7 @@
 #!/bin/sh -x
 
-psql -c 'create database pq_test;' -U postgres
-echo '<?php const PQ_DSN = "postgres://postgres@localhost/pq_test";' > ./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 "<?php const PQ_DSN = '$PQ_DSN';" > ./tests/_setup.inc