.travis.yml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. language: php
  2. sudo: false
  3. git:
  4. depth: 1
  5. cache:
  6. directories:
  7. - $HOME/.composer
  8. - $HOME/bin
  9. env:
  10. global:
  11. - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress"
  12. - COMPOSER_FLAGS=""
  13. before_install:
  14. # turn off XDebug
  15. - phpenv config-rm xdebug.ini || return 0
  16. # Composer: boost installation
  17. - composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
  18. jobs:
  19. include:
  20. -
  21. stage: Static Code Analysis
  22. php: 7.2
  23. env: COMPOSER_FLAGS="--no-dev --prefer-stable"
  24. install:
  25. - travis_retry composer update -d dev-tools $DEFAULT_COMPOSER_FLAGS
  26. - composer info -d dev-tools -D | sort
  27. - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
  28. - composer info -D | sort
  29. - wget --no-clobber --output-document=$HOME/bin/checkbashisms https://sourceforge.net/projects/checkbaskisms/files/2.0.0.2/checkbashisms/download || true
  30. - chmod +x $HOME/bin/checkbashisms
  31. before_script:
  32. - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMIT_RANGE=$TRAVIS_COMMIT_RANGE; else COMMIT_RANGE="HEAD~..HEAD"; fi;
  33. - export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
  34. script:
  35. # @TODO remove at 3.0
  36. - |
  37. git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php \
  38. | grep -v tests/Test/AbstractFixerTestCase.php \
  39. | grep -v tests/Test/AbstractIntegrationCaseFactory.php \
  40. | grep -v tests/Test/AbstractIntegrationTestCase.php \
  41. | grep -v tests/Test/Assert/AssertTokensTrait.php \
  42. | grep -v tests/Test/Constraint/SameStringsConstraint.php \
  43. | grep -v tests/Test/Constraint/SameStringsConstraintForV5.php \
  44. | grep -v tests/Test/Constraint/SameStringsConstraintForV7.php \
  45. | grep -v tests/Test/Constraint/XmlMatchesXsdConstraint.php \
  46. | grep -v tests/Test/Constraint/XmlMatchesXsdConstraintForV5.php \
  47. | grep -v tests/Test/Constraint/XmlMatchesXsdConstraintForV7.php \
  48. | grep -v tests/Test/IntegrationCase.php \
  49. | grep -v tests/Test/IntegrationCaseFactory.php \
  50. | grep -v tests/Test/IntegrationCaseFactoryInterface.php \
  51. | grep -v tests/Test/InternalIntegrationCaseFactory.php \
  52. | grep -v tests/TestCase.php \
  53. && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
  54. - ./check_trailing_spaces.sh || travis_terminate 1
  55. - if [ -n "$COMMIT_SCA_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$COMMIT_SCA_FILES" | grep -Ev "^tests/Fixtures" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
  56. - ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json || travis_terminate 1
  57. - composer normalize -d ./dev-tools ./../composer.json --dry-run
  58. - ./dev-tools/check-shell-scripts.sh
  59. - &STANDARD_TEST_JOB
  60. stage: Fast Test
  61. php: 7.0
  62. install:
  63. # Composer: enforce given Symfony components version
  64. - if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/force-lowest:$SYMFONY_VERSION; fi
  65. - if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update symfony/lts:$(echo $SYMFONY_VERSION | grep -o 'v[0-9]\+') || true; fi
  66. - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
  67. - composer info -D | sort
  68. script:
  69. - vendor/bin/phpunit || travis_terminate 1
  70. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
  71. -
  72. <<: *STANDARD_TEST_JOB
  73. stage: Test
  74. php: 5.6
  75. env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
  76. -
  77. <<: *STANDARD_TEST_JOB
  78. stage: Test
  79. php: 7.1
  80. env: SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="v4.0"
  81. -
  82. <<: *STANDARD_TEST_JOB
  83. stage: Test
  84. php: 7.2
  85. env: COLLECT_COVERAGE=1
  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 vendor/bin/phpunit --group covers-nothing || travis_terminate 1; fi
  94. - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
  95. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
  96. - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/php-coveralls -v; fi
  97. -
  98. <<: *STANDARD_TEST_JOB
  99. stage: Test
  100. php: nightly
  101. env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
  102. script:
  103. - php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,native_function_invocation -q || travis_terminate 1
  104. - vendor/bin/phpunit || travis_terminate 1
  105. - git checkout . -q
  106. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
  107. -
  108. stage: Deployment
  109. php: 7.1
  110. install: ./dev-tools/build.sh
  111. script:
  112. - vendor/bin/phpunit tests/Smoke/PharTest.php
  113. deploy:
  114. provider: releases
  115. api_key:
  116. secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
  117. file: php-cs-fixer.phar
  118. skip_cleanup: true
  119. on:
  120. repo: FriendsOfPHP/PHP-CS-Fixer
  121. tags: true
  122. after_deploy:
  123. - ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
  124. allow_failures:
  125. - php: nightly