mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-10 10:26:35 +00:00
Merge pull request #450 from zachborboa/master
Fix hhvm build failing by running hhvm tests on Trusty
This commit is contained in:
+11
-10
@@ -1,18 +1,19 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.3
|
||||
- 5.4
|
||||
- 5.5
|
||||
- 5.6
|
||||
- 7.0
|
||||
- 7.1
|
||||
- hhvm
|
||||
- nightly
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: nightly
|
||||
include:
|
||||
- php: 5.3
|
||||
- php: 5.4
|
||||
- php: 5.5
|
||||
- php: 5.6
|
||||
- php: 7.0
|
||||
- php: 7.1
|
||||
- php: hhvm
|
||||
dist: trusty
|
||||
- php: hhvm-nightly
|
||||
dist: trusty
|
||||
- php: nightly
|
||||
|
||||
before_script:
|
||||
|
||||
+25
-8
@@ -1,3 +1,5 @@
|
||||
set -x
|
||||
|
||||
phpunit_shim() {
|
||||
# -class CurlTest extends \PHPUnit\Framework\TestCase
|
||||
# +class CurlTest extends \PHPUnit_Framework_TestCase
|
||||
@@ -66,29 +68,44 @@ elif [[ "${TRAVIS_PHP_VERSION}" == "7.0" ]]; then
|
||||
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
||||
elif [[ "${TRAVIS_PHP_VERSION}" == "7.1" ]]; then
|
||||
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
||||
elif [[ "${TRAVIS_PHP_VERSION}" == "hhvm" ]]; then
|
||||
sudo add-apt-repository -y ppa:nginx/stable
|
||||
elif [[ "${TRAVIS_PHP_VERSION}" == "hhvm" || "${TRAVIS_PHP_VERSION}" == "hhvm-nightly" ]]; then
|
||||
curl "https://nginx.org/keys/nginx_signing.key" | sudo apt-key add -
|
||||
echo "deb https://nginx.org/packages/mainline/ubuntu/ trusty nginx" | sudo tee -a /etc/apt/sources.list
|
||||
echo "deb-src https://nginx.org/packages/mainline/ubuntu/ trusty nginx" | sudo tee -a /etc/apt/sources.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y nginx
|
||||
root="$(pwd)/tests/PHPCurlClass"
|
||||
sudo tee /etc/nginx/sites-enabled/default <<EOF
|
||||
sudo tee /etc/nginx/conf.d/default.conf <<"EOF"
|
||||
server {
|
||||
listen 8000 default_server;
|
||||
root ${root};
|
||||
index index.php;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
location / {
|
||||
rewrite ^ /index.php last;
|
||||
fastcgi_pass 127.0.0.1:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
sudo /usr/share/hhvm/install_fastcgi.sh
|
||||
sudo /etc/init.d/hhvm restart
|
||||
sleep 5
|
||||
sudo service nginx stop
|
||||
sleep 5
|
||||
sudo service nginx start
|
||||
|
||||
script_dir="$(dirname "$(readlink -f "$0")")"
|
||||
root="${script_dir}/PHPCurlClass"
|
||||
sudo cp -v "${root}/"* "/usr/share/nginx/html/"
|
||||
|
||||
phpunit_shim
|
||||
|
||||
# Use an older version of PHPUnit for HHVM builds so that unit tests can be
|
||||
# started. HHVM 3.18 (PHP_VERSION=PHP 5.6.99-hhvm) is the last version to
|
||||
# run on Trusty yet PHPUnit 6 requires PHP 7.0 or PHP 7.1.
|
||||
# Avoids error:
|
||||
# This version of PHPUnit is supported on PHP 7.0 and PHP 7.1.
|
||||
# You are using PHP 5.6.99-hhvm (/usr/bin/hhvm).
|
||||
composer require phpunit/phpunit:5.7.*
|
||||
elif [[ "${TRAVIS_PHP_VERSION}" == "nightly" ]]; then
|
||||
php -S 127.0.0.1:8000 -t tests/PHPCurlClass/ &
|
||||
fi
|
||||
|
||||
+9
-4
@@ -1,8 +1,14 @@
|
||||
set -x
|
||||
|
||||
# Use composer's phpunit and phpcs by adding composer bin directory to the path environment variable.
|
||||
export PATH="$PWD/vendor/bin:$PATH"
|
||||
|
||||
errors=0
|
||||
|
||||
# Check syntax in php files. Use `xargs' over `find -exec' as xargs exits with a value of 1 when any command errors.
|
||||
find . -type "f" -iname "*.php" ! -path "*/vendor/*" | xargs -L "1" php -l
|
||||
if [[ "${?}" -ne 0 ]]; then
|
||||
echo "Error: php syntax checks failed"
|
||||
((errors++))
|
||||
fi
|
||||
|
||||
@@ -10,6 +16,7 @@ fi
|
||||
phpunit --version
|
||||
phpunit --configuration "tests/phpunit.xml"
|
||||
if [[ "${?}" -ne 0 ]]; then
|
||||
echo "Error: phpunit command failed"
|
||||
((errors++))
|
||||
fi
|
||||
|
||||
@@ -54,7 +61,7 @@ EOF
|
||||
php --run "${script}" "${filename}"
|
||||
}
|
||||
# Skip hhvm "Notice: File could not be loaded: ..."
|
||||
if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]]; then
|
||||
if [[ "${TRAVIS_PHP_VERSION}" != "hhvm" ]] && [[ "${TRAVIS_PHP_VERSION}" != "hhvm-nightly" ]]; then
|
||||
export -f "find_invalid_indentation"
|
||||
invalid_indentation=$(find . -type "f" -iname "*.php" ! -path "*/vendor/*" -exec bash -c 'find_invalid_indentation "{}"' \;)
|
||||
if [[ ! -z "${invalid_indentation}" ]]; then
|
||||
@@ -112,9 +119,6 @@ if [[ ! -z "${elses}" ]]; then
|
||||
((errors++))
|
||||
fi
|
||||
|
||||
# Add composer bin directory to the path environment variable.
|
||||
export PATH="$PWD/vendor/bin:$PATH"
|
||||
|
||||
# Detect coding standard violations.
|
||||
phpcs --version
|
||||
phpcs \
|
||||
@@ -125,6 +129,7 @@ phpcs \
|
||||
-s \
|
||||
.
|
||||
if [[ "${?}" -ne 0 ]]; then
|
||||
echo "Error: found standard violation(s)"
|
||||
((errors++))
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user