.travis.yml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. before_script:
  29. - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMIT_RANGE=$TRAVIS_COMMIT_RANGE; else COMMIT_RANGE="HEAD~..HEAD"; fi;
  30. - export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
  31. script:
  32. # @TODO remove at 3.0
  33. - git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php | grep -v tests/Test/Assert/AssertTokensTrait.php | grep -v tests/Test/AbstractFixerTestCase.php | grep -v tests/Test/AbstractIntegrationTestCase.php | grep -v tests/Test/IntegrationCase.php | grep -v tests/Test/IntegrationCaseFactory.php && (echo "UNKNOWN FILES DETECTED" && travis_terminate 1) || echo "NO UNKNOWN FILES"
  34. - ./check_trailing_spaces.sh || travis_terminate 1
  35. - if [ -n "$COMMIT_SCA_FILES" ]; then ./dev-tools/vendor/bin/phpmd `echo "$COMMIT_SCA_FILES" | grep -Ev "^(src/Resources|tests/Fixtures)" | xargs | sed 's/ /,/g'` text phpmd.xml || travis_terminate 1; fi
  36. - ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json
  37. - &STANDARD_TEST_JOB
  38. stage: Test
  39. php: 7.0
  40. install:
  41. # Composer: enforce given Symfony components version
  42. - 'if [ "$SYMFONY_VERSION" != "" ]; then sed -i "s/\"symfony\/\([^\"]*\)\": \"^3[^\"]*\"/\"symfony\/\1\": \"$SYMFONY_VERSION\"/g" composer.json; fi'
  43. - 'if [ "$MIN_STABILITY" != "" ]; then composer config minimum-stability $MIN_STABILITY; fi'
  44. - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
  45. - composer info -D | sort
  46. script:
  47. - vendor/bin/phpunit || travis_terminate 1
  48. - php php-cs-fixer --diff --dry-run -v fix
  49. -
  50. <<: *STANDARD_TEST_JOB
  51. php: 5.6
  52. env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
  53. -
  54. <<: *STANDARD_TEST_JOB
  55. php: 7.1
  56. env: SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="^4.0" MIN_STABILITY=dev
  57. -
  58. <<: *STANDARD_TEST_JOB
  59. php: 7.2
  60. env: COLLECT_COVERAGE=1 SYMFONY_DEPRECATIONS_HELPER=weak
  61. before_script:
  62. # check phpdbg
  63. - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
  64. # for building a tag release we don't need to collect code coverage
  65. - if [ $TRAVIS_TAG ]; then export COLLECT_COVERAGE=0; fi
  66. script:
  67. - if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit || travis_terminate 1; fi
  68. - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
  69. - php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
  70. - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/coveralls -v; fi
  71. -
  72. <<: *STANDARD_TEST_JOB
  73. php: nightly
  74. env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
  75. script:
  76. - php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,native_function_invocation -q || travis_terminate 1
  77. - vendor/bin/phpunit || travis_terminate 1
  78. - git checkout . -q
  79. - php php-cs-fixer --diff --dry-run -v fix
  80. -
  81. stage: Deployment
  82. php: 7.1
  83. install: ./dev-tools/build.sh
  84. script:
  85. - php php-cs-fixer.phar --version
  86. - php php-cs-fixer.phar readme
  87. - php php-cs-fixer.phar describe header_comment
  88. - php php-cs-fixer.phar fix src/Config.php -vvv --dry-run --diff
  89. deploy:
  90. provider: releases
  91. api_key:
  92. secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
  93. file: php-cs-fixer.phar
  94. skip_cleanup: true
  95. on:
  96. repo: FriendsOfPHP/PHP-CS-Fixer
  97. tags: true
  98. after_deploy:
  99. - ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
  100. allow_failures:
  101. - php: nightly