Merge remote-tracking branch 'origin/4.0' into 4.1

# Conflicts:
  #	.travis.yml
This commit is contained in:
Robbie Averill 2018-05-28 17:57:27 +12:00
commit dc4b512afb
3 changed files with 43 additions and 26 deletions

View File

@ -2,16 +2,15 @@ language: php
dist: trusty dist: trusty
sudo: required before_install:
- sudo apt-get update
group: deprecated-2017Q4 - sudo apt-get install chromium-chromedriver
cache: cache:
directories: directories:
- $HOME/.composer/cache/files - $HOME/.composer/cache/files
addons: addons:
firefox: "31.0"
apt: apt:
packages: packages:
- tidy - tidy
@ -22,6 +21,8 @@ env:
- COMPOSER_ROOT_VERSION="4.1.x-dev" - COMPOSER_ROOT_VERSION="4.1.x-dev"
- DISPLAY=":99" - DISPLAY=":99"
- XVFBARGS=":99 -ac -screen 0 1024x768x16" - XVFBARGS=":99 -ac -screen 0 1024x768x16"
- SS_BASE_URL="http://localhost:8080/"
- SS_ENVIRONMENT_TYPE="dev"
matrix: matrix:
fast_finish: true fast_finish: true
@ -59,8 +60,16 @@ matrix:
env: env:
- BEHAT_TEST="@asset-admin" - BEHAT_TEST="@asset-admin"
- DB=MYSQL - DB=MYSQL
- php: 5.6
env:
- HEALTH_TEST=1
- DB=MYSQL
- PDO=1
before_script: before_script:
# Extra $PATH
- export PATH=/usr/lib/chromium-browser/:$PATH
# Init PHP # Init PHP
- phpenv rehash - phpenv rehash
- phpenv config-rm xdebug.ini || true - phpenv config-rm xdebug.ini || true
@ -69,23 +78,26 @@ before_script:
# Install composer dependencies # Install composer dependencies
- composer validate - composer validate
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.0.x-dev; fi - if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.0.x-dev; fi
- if [[ $BEHAT_TEST ]]; then composer require --no-update silverstripe/behat-extension:^3 silverstripe/serve:^2 se/selenium-server-standalone:2.41.0; fi; - if [[ $BEHAT_TEST ]]; then composer require --no-update silverstripe/recipe-testing:^1; fi;
- composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile - if [[ $HEALTH_TEST ]]; then composer require --no-update silverstripe/serve:^2; fi;
- if ! [[ $HEALTH_TEST ]]; then composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile; fi;
- if [[ $HEALTH_TEST ]]; then composer install --prefer-dist --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile --no-dev; fi;
# Start behat services # Start behat services
- if [[ $BEHAT_TEST ]]; then echo 'SS_BASE_URL=http://localhost:8080/' >> .env; fi - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then mkdir artifacts; fi
- if [[ $BEHAT_TEST ]]; then mkdir artifacts; fi - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then cp composer.lock artifacts/; fi
- if [[ $BEHAT_TEST ]]; then cp composer.lock artifacts/; fi
- if [[ $BEHAT_TEST ]]; then sh -e /etc/init.d/xvfb start; sleep 3; fi - if [[ $BEHAT_TEST ]]; then sh -e /etc/init.d/xvfb start; sleep 3; fi
- if [[ $BEHAT_TEST ]]; then (vendor/bin/selenium-server-standalone > artifacts/selenium.log 2>&1 &); fi - if [[ $BEHAT_TEST ]]; then (chromedriver > artifacts/chromedriver.log 2>&1 &); fi
- if [[ $BEHAT_TEST ]]; then (vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); fi - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then (vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php &> artifacts/serve.log &); sleep 3; fi
script: script:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit --testsuite $PHPUNIT_TEST; fi - if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit --testsuite $PHPUNIT_TEST; fi
- if [[ $BEHAT_TEST ]]; then vendor/bin/behat $BEHAT_TEST; fi - if [[ $BEHAT_TEST ]]; then vendor/bin/behat $BEHAT_TEST; fi
- if [[ $HEALTH_TEST ]]; then curl -vfL http://localhost:8080/dev/build?flush; fi
- if [[ $HEALTH_TEST ]]; then curl -vfL http://localhost:8080/admin; fi
after_failure: after_failure:
- if [[ $BEHAT_TEST ]]; then php ./vendor/silverstripe/framework/tests/behat/travis-upload-artifacts.php --if-env BEHAT_TEST,ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/ --artifacts-path ./artifacts/; fi - if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then php ./vendor/silverstripe/framework/tests/behat/travis-upload-artifacts.php --if-env ARTIFACTS_BUCKET,ARTIFACTS_KEY,ARTIFACTS_SECRET --target-path $TRAVIS_REPO_SLUG/$TRAVIS_BUILD_ID/$TRAVIS_JOB_ID --artifacts-base-url https://s3.amazonaws.com/$ARTIFACTS_BUCKET/ --artifacts-path ./artifacts/; fi
notifications: notifications:
slack: silverstripeltd:Cls1xnypKBLFhv0YIRtNLzlQ slack: silverstripeltd:Cls1xnypKBLFhv0YIRtNLzlQ

View File

@ -1,20 +1,20 @@
# Note: Currently firefox 31-ESR is recommended # Note: Currently chrome latest is recommended
# Behat test setup requires an `.env` with `SS_BASE_URL` defined, as well # Behat test setup requires an `.env` with `SS_BASE_URL` defined, as well
# as each of the following commands to initiate a test run: # as each of the following commands to initiate a test run:
# ========================================================================= # # ========================================================================= #
# composer require silverstripe/behat-extension:^3 silverstripe/serve:dev-master se/selenium-server-standalone:2.41.0 # composer require silverstripe/recipe-testing ^1
# vendor/bin/selenium-server-standalone -Dwebdriver.firefox.bin="/Applications/Firefox31.app/Contents/MacOS/firefox-bin" # vendor/bin/behat-ss @<module>
# vendor/bin/serve --bootstrap-file vendor/silverstripe/cms/tests/behat/serve-bootstrap.php
# vendor/bin/behat @<module>
# ========================================================================= # # ========================================================================= #
default: default:
suites: [] suites: []
extensions: extensions:
SilverStripe\BehatExtension\MinkExtension: SilverStripe\BehatExtension\MinkExtension:
default_session: selenium2 default_session: facebook_web_driver
javascript_session: selenium2 javascript_session: facebook_web_driver
selenium2: facebook_web_driver:
browser: firefox browser: chrome
wd_host: "http://127.0.0.1:9515" #chromedriver port
browser_name: chrome
SilverStripe\BehatExtension\Extension: SilverStripe\BehatExtension\Extension:
bootstrap_file: vendor/silverstripe/cms/tests/behat/serve-bootstrap.php bootstrap_file: vendor/silverstripe/cms/tests/behat/serve-bootstrap.php
screenshot_path: %paths.base%/artifacts/screenshots screenshot_path: %paths.base%/artifacts/screenshots

View File

@ -4,6 +4,15 @@
# See AssetAdapter::renderTemplate() for reference. # See AssetAdapter::renderTemplate() for reference.
# #
# We disable PHP via several methods
# Replace the handler with the default plaintext handler
AddHandler default-handler php phtml php3 php4 php5 inc
<IfModule mod_php5.c>
# Turn the PHP engine off
php_flag engine off
</IfModule>
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
<IfModule mod_env.c> <IfModule mod_env.c>
SetEnv HTTP_MOD_REWRITE On SetEnv HTTP_MOD_REWRITE On
@ -11,16 +20,12 @@
RewriteEngine On RewriteEngine On
# Disable PHP handler
RewriteCond %{REQUEST_URI} .(?i:php|phtml|php3|php4|php5|inc)$
RewriteRule .* - [F]
# Allow error pages # Allow error pages
RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} -f
RewriteRule error[^\\/]*\.html$ - [L] RewriteRule error[^\\/]*\.html$ - [L]
# Block invalid file extensions # Block invalid file extensions
RewriteCond %{REQUEST_URI} !\.(?i:ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|css|csv|dmg|doc|docx|dotx|dotm|flv|gif|gpx|gz|hqx|ico|jar|jpeg|jpg|js|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|png|pps|ppt|pptx|potx|potm|ra|ram|rm|rtf|sit|sitx|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xls|xlsx|xltx|xltm|zip|zipx)$ RewriteCond %{REQUEST_URI} !^[^.]*\.(?i:css|js|ace|arc|arj|asf|au|avi|bmp|bz2|cab|cda|csv|dmg|doc|docx|dotx|flv|gif|gpx|gz|hqx|ico|jpeg|jpg|kml|m4a|m4v|mid|midi|mkv|mov|mp3|mp4|mpa|mpeg|mpg|ogg|ogv|pages|pcx|pdf|png|pps|ppt|pptx|potx|ra|ram|rm|rtf|sit|sitx|tar|tgz|tif|tiff|txt|wav|webm|wma|wmv|xls|xlsx|xltx|zip|zipx)$
RewriteRule .* - [F] RewriteRule .* - [F]
# Non existant files passed to requesthandler # Non existant files passed to requesthandler