.travis.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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 require --dev php-cs-fixer/phpunit-constraint-isidenticalstring:^1.0 || true # install if possible, move to require-dev section on 2.11
  68. - composer require --dev php-cs-fixer/phpunit-constraint-xmlmatchesxsd:^1.0 || true # install if possible, move to require-dev section on 2.11
  69. - composer info -D | sort
  70. script:
  71. - vendor/bin/phpunit || travis_terminate 1
  72. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
  73. -
  74. <<: *STANDARD_TEST_JOB
  75. stage: Test
  76. php: 5.6
  77. env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
  78. -
  79. <<: *STANDARD_TEST_JOB
  80. stage: Test
  81. php: 7.1
  82. env: SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="v4.0"
  83. -
  84. <<: *STANDARD_TEST_JOB
  85. stage: Test
  86. php: 7.2
  87. env: COLLECT_COVERAGE=1
  88. before_script:
  89. # check phpdbg
  90. - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
  91. # for building a tag release we don't need to collect code coverage
  92. - if [ $TRAVIS_TAG ]; then export COLLECT_COVERAGE=0; fi
  93. script:
  94. - if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit || travis_terminate 1; fi
  95. - if [ $COLLECT_COVERAGE == 1 ]; then vendor/bin/phpunit --group covers-nothing || travis_terminate 1; fi
  96. - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --exclude-group covers-nothing --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
  97. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
  98. - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/php-coveralls -v; fi
  99. -
  100. <<: *STANDARD_TEST_JOB
  101. stage: Test
  102. php: nightly
  103. env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
  104. script:
  105. - php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,native_function_invocation -q || travis_terminate 1
  106. - vendor/bin/phpunit || travis_terminate 1
  107. - git checkout . -q
  108. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
  109. -
  110. stage: Deployment
  111. php: 7.1
  112. install: ./dev-tools/build.sh
  113. script:
  114. - vendor/bin/phpunit tests/Smoke/PharTest.php
  115. deploy:
  116. provider: releases
  117. api_key:
  118. secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
  119. file: php-cs-fixer.phar
  120. skip_cleanup: true
  121. on:
  122. repo: FriendsOfPHP/PHP-CS-Fixer
  123. tags: true
  124. after_deploy:
  125. - ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
  126. allow_failures:
  127. - php: nightly