.travis.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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: Fast 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_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
  49. -
  50. <<: *STANDARD_TEST_JOB
  51. stage: Test
  52. php: 5.6
  53. env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
  54. -
  55. <<: *STANDARD_TEST_JOB
  56. stage: Test
  57. php: 7.1
  58. env: SYMFONY_DEPRECATIONS_HELPER=weak SYMFONY_VERSION="^4.0" MIN_STABILITY=dev
  59. -
  60. <<: *STANDARD_TEST_JOB
  61. stage: Test
  62. php: 7.2
  63. env: COLLECT_COVERAGE=1
  64. before_script:
  65. # check phpdbg
  66. - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
  67. # for building a tag release we don't need to collect code coverage
  68. - if [ $TRAVIS_TAG ]; then export COLLECT_COVERAGE=0; fi
  69. script:
  70. - if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit || travis_terminate 1; fi
  71. - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
  72. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
  73. - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/php-coveralls -v; fi
  74. -
  75. <<: *STANDARD_TEST_JOB
  76. stage: Test
  77. php: nightly
  78. env: COMPOSER_FLAGS="--ignore-platform-reqs" PHP_CS_FIXER_IGNORE_ENV=1 SYMFONY_DEPRECATIONS_HELPER=weak
  79. script:
  80. - php php-cs-fixer fix --rules @PHP71Migration,@PHP71Migration:risky,native_function_invocation -q || travis_terminate 1
  81. - vendor/bin/phpunit || travis_terminate 1
  82. - git checkout . -q
  83. - PHP_CS_FIXER_FUTURE_MODE=1 php php-cs-fixer --diff --dry-run -v fix
  84. -
  85. stage: Deployment
  86. php: 7.1
  87. install: ./dev-tools/build.sh
  88. script:
  89. - php php-cs-fixer.phar --version
  90. - php php-cs-fixer.phar readme
  91. - php php-cs-fixer.phar describe header_comment
  92. - php php-cs-fixer.phar fix src/Config.php -vvv --dry-run --diff
  93. deploy:
  94. provider: releases
  95. api_key:
  96. secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
  97. file: php-cs-fixer.phar
  98. skip_cleanup: true
  99. on:
  100. repo: FriendsOfPHP/PHP-CS-Fixer
  101. tags: true
  102. after_deploy:
  103. - ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
  104. allow_failures:
  105. - php: nightly