Add support for Travis CI
authorDavey Shafik <me@daveyshafik.com>
Thu, 26 Apr 2012 11:48:49 +0000 (07:48 -0400)
committerDavey Shafik <me@daveyshafik.com>
Mon, 28 May 2012 10:22:24 +0000 (06:22 -0400)
.travis.yml [new file with mode: 0644]
run-tests.php
travis/compile.sh [new file with mode: 0755]

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..feff37e
--- /dev/null
@@ -0,0 +1,11 @@
+language: php
+# We only specify one version so we only get one worker
+php:
+    - 5.4
+# Compile PHP
+before_script:
+    - ./travis/compile.sh
+# Return 1 with failed testso
+env: REPORT_EXIT_STATUS=1
+# Run PHP's make test
+script: make test
index 2b37ec4f4af69cfdf0f2fc9e4702eb1ff3c0a9b0..4af9a4f3a6308a9cb43deefbaab43486a512f98e 100755 (executable)
@@ -311,6 +311,7 @@ VALGRIND    : " . ($leak_check ? $valgrind_header : 'Not used') . "
 define('PHP_QA_EMAIL', 'qa-reports@lists.php.net');
 define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
 define('QA_REPORTS_PAGE', 'http://qa.php.net/reports');
+define('TRAVIS_CI' , !!getenv('TRAVIS_PHP_VERSION')); 
 
 function save_or_mail_results()
 {
@@ -318,7 +319,7 @@ function save_or_mail_results()
                   $PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file, $compression;
 
        /* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */
-       if (!getenv('NO_INTERACTION')) {
+       if (!getenv('NO_INTERACTION') && !TRAVIS_CI) {
                $fp = fopen("php://stdin", "r+");
                if ($sum_results['FAILED'] || $sum_results['BORKED'] || $sum_results['WARNED'] || $sum_results['LEAKED'] || $sum_results['XFAILED']) {
                        echo "\nYou may have found a problem in PHP.";
@@ -335,8 +336,8 @@ function save_or_mail_results()
                $just_save_results = (strtolower($user_input[0]) == 's');
        }
 
-       if ($just_save_results || !getenv('NO_INTERACTION')) {
-               if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
+       if ($just_save_results || !getenv('NO_INTERACTION') || TRAVIS_CI) {
+               if ($just_save_results || TRAVIS_CI || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
                        /*
                         * Collect information about the host system for our report
                         * Fetch phpinfo() output so that we can see the PHP enviroment
@@ -348,7 +349,9 @@ function save_or_mail_results()
                        }
 
                        /* Ask the user to provide an email address, so that QA team can contact the user */
-                       if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
+            if (TRAVIS_CI) {
+                $user_email = 'travis at php dot net';
+            } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
                                echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): ";
                                flush();
                                $user_email = trim(fgets($fp, 1024));
@@ -424,7 +427,7 @@ function save_or_mail_results()
                        $failed_tests_data .= $sep . "PHPINFO" . $sep;
                        $failed_tests_data .= shell_exec($php . ' -ddisplay_errors=stderr -dhtml_errors=0 -i 2> /dev/null');
 
-                       if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) {
+                       if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status) && !TRAVIS_CI) {
                                file_put_contents($output_file, $failed_tests_data);
 
                                if (!$just_save_results) {
@@ -432,7 +435,7 @@ function save_or_mail_results()
                                }
 
                                echo "Please send " . $output_file . " to " . PHP_QA_EMAIL . " manually, thank you.\n";
-                       } else {
+                       } elseif (!getenv('NO_INTERACTION') && !TRAVIS_CI) {
                                fwrite($fp, "\nThank you for helping to make PHP better.\n");
                                fclose($fp);
                        }
diff --git a/travis/compile.sh b/travis/compile.sh
new file mode 100755 (executable)
index 0000000..f80cc6b
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+./buildconf
+./configure --with-pdo-mysql --with-mysql --with-sqlite --with-pdo-sqlite
+make