.travis.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. language: php
  2. sudo: false
  3. git:
  4. depth: 1
  5. env:
  6. global:
  7. - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress --optimize-autoloader"
  8. - TASK_TESTS=1
  9. - TASK_TESTS_COVERAGE=0
  10. - TASK_CS=1
  11. - TASK_SCA=0
  12. matrix:
  13. fast_finish: true
  14. include:
  15. - php: 7.0
  16. env: DEPLOY=yes TASK_TESTS_COVERAGE=1
  17. - php: 7.1
  18. env: TASK_SCA=1
  19. - php: 5.3
  20. env: SKIP_LINT_TEST_CASES=1 COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
  21. - php: 5.4
  22. env: SKIP_LINT_TEST_CASES=1
  23. - php: 5.5
  24. env: SKIP_LINT_TEST_CASES=1
  25. - php: 5.6
  26. - php: 7.1
  27. env: SYMFONY_VERSION="^2.8"
  28. # Use the newer stack for HHVM as HHVM does not support Precise anymore since a long time and so Precise has an outdated version
  29. - php: hhvm-3.9
  30. env: SKIP_LINT_TEST_CASES=1
  31. sudo: required
  32. dist: trusty
  33. group: edge
  34. - php: hhvm
  35. env: SKIP_LINT_TEST_CASES=1
  36. sudo: required
  37. dist: trusty
  38. group: edge
  39. cache:
  40. directories:
  41. - $HOME/.composer/cache
  42. before_install:
  43. # check phpdbg
  44. - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export TASK_TESTS_COVERAGE=0; }
  45. # turn off XDebug
  46. - phpenv config-rm xdebug.ini || return 0
  47. # validate tasks configuration
  48. - if [ $TASK_TESTS == 0 ] && [ $TASK_TESTS_COVERAGE == 1 ]; then travis_terminate 1; fi
  49. # for building a tag release we don't need to run SCA tools, collect code coverage or self-fix CS
  50. - if [ $TRAVIS_TAG ]; then export TASK_SCA=0; fi
  51. - if [ $TRAVIS_TAG ]; then export TASK_TESTS_COVERAGE=0; fi
  52. - if [ $TRAVIS_TAG ]; then export TASK_CS=0; fi
  53. # Composer: boost installation
  54. - travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
  55. # Composer: enforce given Symfony components version
  56. - 'if [ "$SYMFONY_VERSION" != "" ]; then sed -i "s/\"symfony\/\([^\"]*\)\": \"^2[^\"]*\"/\"symfony\/\1\": \"$SYMFONY_VERSION\"/g" composer.json; fi'
  57. # display tasks configuration for a job
  58. - set | grep ^TASK | sort
  59. install:
  60. - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
  61. - composer info -D | sort
  62. script:
  63. - if [ $TASK_SCA == 1 ]; then php php-cs-fixer fix --rules declare_strict_types,native_function_invocation -q; fi
  64. - if [ $TASK_SCA == 1 ]; then files_with_trailing_spaces=`find . -type f -not -path "./.git/*" -not -path "./vendor/*" -not -path "./tests/Fixtures/*" -exec egrep -nH " $" {} \;` && [[ $files_with_trailing_spaces ]] && echo $files_with_trailing_spaces && travis_terminate 1 || echo "No trailing spaces detected."; fi
  65. - if [ $TASK_TESTS == 1 ] && [ $TASK_TESTS_COVERAGE == 0 ]; then vendor/bin/phpunit --verbose; fi
  66. - if [ $TASK_TESTS == 1 ] && [ $TASK_TESTS_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml; fi
  67. - if [ $TASK_SCA == 1 ]; then git checkout . -q; fi
  68. - if [ $TASK_CS == 1 ]; then php php-cs-fixer --diff --dry-run -v fix; fi
  69. after_success:
  70. - if [ $TASK_TESTS_COVERAGE == 1 ]; then php vendor/bin/coveralls -v; fi
  71. before_deploy:
  72. # install box2
  73. - curl -LSs http://box-project.github.io/box2/installer.php | php
  74. - php box.phar --version
  75. # ensure that deps will work on lowest supported PHP version
  76. - composer config platform.php 2> /dev/null || composer config platform.php 5.3.6
  77. # update deps to highest possible for lowest supported PHP version
  78. - composer update $DEFAULT_COMPOSER_FLAGS --no-dev --prefer-stable
  79. - composer info -D | sort
  80. # build phar file
  81. - php -d phar.readonly=false box.phar build
  82. deploy:
  83. provider: releases
  84. api_key:
  85. secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
  86. file: php-cs-fixer.phar
  87. skip_cleanup: true
  88. on:
  89. repo: FriendsOfPHP/PHP-CS-Fixer
  90. tags: true
  91. condition: $DEPLOY = yes