silverstripe-installer/.travis.yml
2020-02-26 14:58:21 +13:00

128 lines
3.9 KiB
YAML

language: php
dist: xenial
services:
- mysql
- postgresql
- xvfb
cache:
directories:
- $HOME/.composer/cache/files
addons:
apt:
packages:
- tidy
- chromium-chromedriver
- chromium-browser
env:
global:
- TRAVIS_NODE_VERSION="6"
- COMPOSER_ROOT_VERSION="4.5.x-dev"
- SS_BASE_URL="http://localhost:8080/"
- SS_ENVIRONMENT_TYPE="dev"
matrix:
fast_finish: true
include:
# Core php tests
- php: 7.1
env:
- PHPUNIT_TEST=core
- DB=MYSQL
- PDO=1
- php: 7.2
env:
- PHPUNIT_TEST=framework
- DB=MYSQL
- php: 7.3
env:
- PHPUNIT_TEST=core
- DB=PGSQL
- php: 7.4
env:
- PHPUNIT_TEST=core
- DB=MYSQL
# admin php tests
- php: 7.1
env:
- PHPUNIT_TEST=admin
- DB=PGSQL
- php: 7.2
env:
- PHPUNIT_TEST=admin
- DB=MYSQL
- PDO=1
- php: 7.4
env:
- PHPUNIT_TEST=admin
- DB=MYSQL
# behat tests
- php: 7.1
env:
- BEHAT_TEST="@framework"
- DB=MYSQL
- php: 7.2
env:
- BEHAT_TEST="@cms"
- DB=MYSQL
- php: 7.3
env:
- BEHAT_TEST="@asset-admin"
- DB=MYSQL
- php: 7.3
env:
- HEALTH_TEST=1
- DB=PGSQL
- php: 7.4
env:
- HEALTH_TEST=1
- DB=MYSQL
- PDO=1
before_script:
# Extra $PATH
- export PATH=/usr/lib/chromium-browser/:$PATH
# Remove preinstalled Chrome (google-chrome)
# this would conflict with our chromium-browser installation
# and its version is incompatible with chromium-chromedriver
- sudo apt-get remove -y --purge google-chrome-stable || true
# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini || true
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Install composer dependencies
- composer validate
- if [[ $DB == PGSQL ]]; then composer require --no-update silverstripe/postgresql:2.2.x-dev; fi
- if [[ $BEHAT_TEST ]]; then composer require --no-update silverstripe/recipe-testing:^1; fi;
- if [[ $HEALTH_TEST ]]; then composer require --no-update silverstripe/serve:^2; fi;
- if ! [[ $HEALTH_TEST ]]; then composer install --prefer-source --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
- if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then mkdir artifacts; fi
- if [[ $BEHAT_TEST ]] || [[ $HEALTH_TEST ]]; then cp composer.lock artifacts/; fi
- if [[ $BEHAT_TEST ]]; then (chromedriver > artifacts/chromedriver.log 2>&1 &); 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:
- if [[ $PHPUNIT_TEST ]]; then vendor/bin/phpunit --testsuite $PHPUNIT_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:
- 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:
slack:
on_pull_requests: false
rooms:
secure: pr4kG5tTMqZy1DLejHd1MpPulAE7FtRvTYekWrKIbQF0SkbFz+s3v9fAk2AqCr+SxfV67M3M+sL52/q6TDjeGYJJttwA60gyfH/Qrc/ToCYP3J80Ca/hsk02mya0pF8Kpjg37XP8kNzAllR162mCwYKJgFiXO6Q1eb/aVJwiqmQ=