.travis.yml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. language: php
  2. sudo: false
  3. git:
  4. depth: 1
  5. cache:
  6. directories:
  7. - $HOME/.composer
  8. env:
  9. global:
  10. - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress"
  11. - COMPOSER_FLAGS=""
  12. before_install:
  13. # turn off XDebug
  14. - phpenv config-rm xdebug.ini || return 0
  15. # Composer: boost installation
  16. - composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
  17. jobs:
  18. include:
  19. -
  20. stage: Static Code Analysis
  21. php: 7.2
  22. env: COMPOSER_FLAGS="--no-dev --prefer-stable"
  23. install:
  24. - travis_retry composer update -d dev-tools $DEFAULT_COMPOSER_FLAGS
  25. - composer info -d dev-tools -D | sort
  26. - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
  27. - composer info -D | sort
  28. script:
  29. # @TODO remove at 3.0
  30. - |
  31. git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php \
  32. | grep -v tests/Test/AbstractFixerTestCase.php \
  33. | grep -v tests/Test/AbstractIntegrationCaseFactory.php \
  34. | grep -v tests/Test/AbstractIntegrationTestCase.php \
  35. | grep -v tests/Test/Assert/AssertTokensTrait.php \
  36. | grep -v tests/Test/IntegrationCase.php \
  37. | grep -v tests/Test/IntegrationCaseFactory.php \
  38. | grep -v tests/Test/IntegrationCaseFactoryInterface.php \
  39. | grep -v tests/TestCase.php \
  40. && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
  41. - ./check_trailing_spaces.sh || travis_terminate 1
  42. - ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json
  43. - &STANDARD_TEST_JOB
  44. stage: Fast Test
  45. php: 7.0
  46. install:
  47. # Composer: enforce given Symfony components version
  48. - 'if [ "$SYMFONY_VERSION" != "" ]; then sed -i "s/\"symfony\/\([^\"]*\)\": \"^2[^\"]*\"/\"symfony\/\1\": \"$SYMFONY_VERSION\"/g" composer.json; fi'
  49. - 'if [ "$MIN_STABILITY" != "" ]; then composer config minimum-stability $MIN_STABILITY; fi'
  50. - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
  51. - composer info -D | sort
  52. script:
  53. - vendor/bin/phpunit || travis_terminate 1
  54. - php php-cs-fixer --diff --dry-run -v fix
  55. -
  56. <<: *STANDARD_TEST_JOB
  57. stage: Test
  58. php: 5.3
  59. env: SKIP_LINT_TEST_CASES=1 COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
  60. dist: precise
  61. -
  62. <<: *STANDARD_TEST_JOB
  63. stage: Test
  64. php: 5.4
  65. env: SKIP_LINT_TEST_CASES=1
  66. -
  67. <<: *STANDARD_TEST_JOB
  68. stage: Test
  69. php: 5.5
  70. env: SKIP_LINT_TEST_CASES=1
  71. -
  72. <<: *STANDARD_TEST_JOB
  73. stage: Test
  74. php: 5.6
  75. env: SYMFONY_VERSION="^2.8"
  76. -
  77. <<: *STANDARD_TEST_JOB
  78. stage: Test
  79. php: 7.1
  80. env: PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="^4.0" MIN_STABILITY=dev
  81. -
  82. <<: *STANDARD_TEST_JOB
  83. stage: Test
  84. php: 7.2
  85. env: COLLECT_COVERAGE=1 SYMFONY_DEPRECATIONS_HELPER=weak
  86. before_script:
  87. # check phpdbg
  88. - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
  89. # for building a tag release we don't need to collect code coverage
  90. - if [ $TRAVIS_TAG ]; then export COLLECT_COVERAGE=0; fi
  91. script:
  92. - if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit || travis_terminate 1; fi
  93. - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
  94. - php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
  95. - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/coveralls -v; fi
  96. -
  97. <<: *STANDARD_TEST_JOB
  98. stage: Test
  99. php: nightly
  100. env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
  101. script:
  102. - php php-cs-fixer fix --rules @PHP70Migration:risky,@PHP71Migration,native_function_invocation -q || travis_terminate 1
  103. - vendor/bin/phpunit || travis_terminate 1
  104. - git checkout . -q
  105. - php php-cs-fixer --diff --dry-run -v fix
  106. -
  107. <<: *STANDARD_TEST_JOB
  108. stage: Test
  109. php: hhvm
  110. env: SKIP_LINT_TEST_CASES=1
  111. sudo: required
  112. dist: trusty
  113. group: edge
  114. -
  115. stage: Deployment
  116. php: 7.1
  117. install: ./dev-tools/build.sh
  118. script:
  119. - vendor/bin/phpunit tests/Smoke/PharTest.php
  120. deploy:
  121. provider: releases
  122. api_key:
  123. secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
  124. file: php-cs-fixer.phar
  125. skip_cleanup: true
  126. on:
  127. repo: FriendsOfPHP/PHP-CS-Fixer
  128. tags: true
  129. after_deploy:
  130. - ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
  131. allow_failures:
  132. - php: nightly