123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- language: php
- sudo: false
- git:
- depth: 1
- cache:
- directories:
- - $HOME/.composer
- env:
- global:
- - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-progress"
- - COMPOSER_FLAGS=""
- before_install:
- # turn off XDebug
- - phpenv config-rm xdebug.ini || return 0
- # Composer: boost installation
- - composer global show -ND 2>&1 | grep "hirak/prestissimo" || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo
- jobs:
- include:
- -
- stage: Static Code Analysis
- php: 7.1
- env: COMPOSER_FLAGS="--no-dev --prefer-stable"
- install:
- - travis_retry composer update -d dev-tools $DEFAULT_COMPOSER_FLAGS
- - composer info -d dev-tools -D | sort
- - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- - composer info -D | sort
- before_script:
- - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then COMMIT_RANGE=$TRAVIS_COMMIT_RANGE; else COMMIT_RANGE="HEAD~..HEAD"; fi;
- - export COMMIT_SCA_FILES=`git diff --name-only --diff-filter=ACMRTUXB $COMMIT_RANGE`
- script:
- # @TODO remove at 3.0
- - if [ $TASK_SCA == 1 ]; then 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"; fi
- - ./check_trailing_spaces.sh || travis_terminate 1
- - 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
- - ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file=.composer-require-checker.json
- - &STANDARD_TEST_JOB
- stage: Test
- php: 7.0
- install:
- - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- - composer info -D | sort
- script:
- - vendor/bin/phpunit --verbose || travis_terminate 1
- - php php-cs-fixer --diff --dry-run -v fix
- -
- <<: *STANDARD_TEST_JOB
- php: 5.6
- env: COMPOSER_FLAGS="--prefer-stable --prefer-lowest"
- -
- <<: *STANDARD_TEST_JOB
- php: 7.1
- env: COLLECT_COVERAGE=1
- before_script:
- # check phpdbg
- - phpdbg --version 2> /dev/null || { echo 'No phpdbg'; export COLLECT_COVERAGE=0; }
- # for building a tag release we don't need to collect code coverage
- - if [ $TRAVIS_TAG ]; then export COLLECT_COVERAGE=0; fi
- script:
- - if [ $COLLECT_COVERAGE == 0 ]; then vendor/bin/phpunit --verbose || travis_terminate 1; fi
- - if [ $COLLECT_COVERAGE == 1 ]; then phpdbg -qrr vendor/bin/phpunit --verbose --coverage-clover build/logs/clover.xml || travis_terminate 1; fi
- - php php-cs-fixer --diff --dry-run -v fix || travis_terminate 1
- - if [ $COLLECT_COVERAGE == 1 ]; then php vendor/bin/coveralls -v; fi
- -
- <<: *STANDARD_TEST_JOB
- php: nightly
- env: COMPOSER_FLAGS="--ignore-platform-reqs" SYMFONY_DEPRECATIONS_HELPER=weak PHP_CS_FIXER_IGNORE_ENV=1 PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1
- script:
- - php php-cs-fixer fix --rules @PHP70Migration:risky,@PHP71Migration,native_function_invocation -q || travis_terminate 1
- - vendor/bin/phpunit --verbose || travis_terminate 1
- - git checkout . -q
- - php php-cs-fixer --diff --dry-run -v fix
- -
- stage: Deployment
- php: 7.1
- env: COMPOSER_FLAGS="--no-dev --prefer-stable"
- install: skip
- script: skip
- before_deploy:
- # ensure that deps will work on lowest supported PHP version
- - composer config platform.php 2> /dev/null || composer config platform.php 5.6.0
- # require suggested packages
- - composer require --no-update symfony/polyfill-mbstring
- - travis_retry composer update $DEFAULT_COMPOSER_FLAGS $COMPOSER_FLAGS
- - composer info -D | sort
- # install box2
- - curl -LSs http://box-project.github.io/box2/installer.php | php
- - php box.phar --version
- # build phar file
- - php -d phar.readonly=false box.phar build
- deploy:
- provider: releases
- api_key:
- secure: K9NKi7X1OPz898fxtVc1RfWrSI+4hTFFYOik932wTz1jC4dQJ64Khh1LV9frA1+JiDS3+R6TvmQtpzbkX3y4L75UrSnP1ADH5wfMYIVmydG3ZjTMo8SWQWHmRMh3ORAKTMMpjl4Q7EkRkLp6RncKe+FAFPP5mgv55mtIMaE4qUk=
- file: php-cs-fixer.phar
- skip_cleanup: true
- on:
- repo: FriendsOfPHP/PHP-CS-Fixer
- tags: true
- after_deploy:
- - ./dev-tools/trigger-website.sh ${TRAVIS_TOKEN} ${TRAVIS_TAG}
|