Created
January 26, 2016 15:41
-
-
Save mdwheele/aa9f341c462e4c82d90d to your computer and use it in GitHub Desktop.
Example Travis CI Configuration for PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: php | |
sudo: false | |
matrix: | |
fast_finish: true | |
include: | |
- php: 7.0 | |
env: WITH_COVERAGE=true | |
- php: 5.6 | |
env: WITH_CS=true | |
- php: 5.5 | |
env: | |
global: | |
- TRAVIS_DB=cfp_travis | |
- CODECLIMATE_REPO_TOKEN=9deb249b01a414d979959cfd05a4c351b19a5959858653b20276454d4189edc3 | |
# cache composer downloads so installing is quicker | |
cache: | |
directories: | |
- $HOME/.composer/cache | |
before_install: | |
- if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then COLLECT_COVERAGE=true; else COLLECT_COVERAGE=false; fi | |
- if [[ "$COLLECT_COVERAGE" == "false" ]]; then phpenv config-rm xdebug.ini; fi | |
- composer self-update | |
- composer validate --no-check-publish | |
install: | |
- composer install | |
before_script: | |
- sh tools/travis/setup-mail.sh | |
- mysql -e "CREATE DATABASE $TRAVIS_DB" -uroot | |
- vendor/bin/phinx --configuration=phinx.yml.dist migrate -e testing | |
script: | |
- if [[ "$COLLECT_COVERAGE" == "true" ]]; then vendor/bin/phpunit --coverage-clover build/logs/clover.xml; else vendor/bin/phpunit; fi | |
- if [[ "$WITH_CS" == "true" ]]; then vendor/bin/php-cs-fixer fix --verbose; fi | |
after_success: | |
- if [[ "$COLLECT_COVERAGE" == "true" ]]; then vendor/bin/test-reporter --coverage-report build/logs/clover.xml; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment