os: linux dist: bionic language: php php: # 7.2 is covered in minimal dependencies - '7.3' - '7.4' before_install: # turn off XDebug - phpenv config-rm xdebug.ini install: - composer install --no-progress script: - vendor/bin/phpunit --testsuite main stages: - test - name: compile if: (branch = master OR tag IS present) && type = push - name: phar if: (branch = master OR tag IS present) && type = push - coverage jobs: include: - stage: compile name: "Compile Rector to prefixed PHAR" php: 7.2 script: - cd compiler - composer install - bin/compile - ../tmp/rector.phar # inspired by https://github.com/phpstan/phpstan-src/blob/088b9fab470632cea07f08a936fb0923a59b2ecb/.travis.yml#L47-L59 - stage: phar name: "Deploy PHAR to https://github.com/rectorphp/rector-prefixed" php: 7.2 script: # reuse tmp/rector.phar from previous job - git clone https://${GITHUB_TOKEN}@github.com/rectorphp/rector-prefixed.git rector-prefixed > /dev/null 2>&1 - cp tmp/rector.phar rector-prefixed/rector.phar - cp tmp/rector.phar rector-prefixed/rector - cd rector-prefixed - git config user.name "TomasVotruba" - git config user.email "tomas.vot@gmail.com" - git add rector rector.phar - if [ "${TRAVIS_TAG}" != "" ]; then COMMIT_MSG="Rector ${TRAVIS_TAG}"; else COMMIT_MSG="Updated Rector to commit ${TRAVIS_COMMIT}"; fi - git commit -m "${COMMIT_MSG}" - git push --quiet origin master - if [ "${TRAVIS_TAG}" != "" ]; then git tag "${TRAVIS_TAG}" && git push --quiet origin ${TRAVIS_TAG}; fi # Stage 1 - stage: test php: 7.2 name: "PHP: 7.2 with Lowest dependencies" install: # install lowest dependencies - composer update --prefer-lowest --no-progress - # Run standalone install in non-root package, ref https://github.com/rectorphp/rector/issues/732 stage: test php: 7.3 name: Standalone Run script: # 1. install locally - mkdir test-paths - cd test-paths - mkdir rector-dir - composer require rector/rector:@dev -d rector-dir - mkdir symfony-demo-dir - composer create-project symfony/symfony-demo symfony-demo-dir --dev # missing for some reason - composer require doctrine/doctrine-fixtures-bundle -d symfony-demo-dir - composer dump-autoload --no-dev -d symfony-demo-dir # 2. run an another project - rector-dir/vendor/bin/rector - cd symfony-demo-dir - ../rector-dir/vendor/bin/rector # --hide-autoload-errors due to skipped dev deps and mixes tests in /src - ../rector-dir/vendor/bin/rector process src --set code-quality --hide-autoload-errors --dry-run # Stage 2 - stage: test php: 7.3 name: Test Coverage script: - phpdbg -qrr -d memory_limit=-1 vendor/bin/phpunit --coverage-clover coverage.xml # Coveralls.io - wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar - php php-coveralls.phar --verbose allow_failures: - name: Standalone Run cache: directories: - $HOME/.composer/cache - tmp notifications: email: false