rector/.travis.yml
2019-12-27 18:55:58 +01:00

182 lines
5.6 KiB
YAML

os: linux
dist: bionic
language: php
php:
- '7.3'
- '7.4'
before_install:
# turn off XDebug
- phpenv config-rm xdebug.ini || return 0
install:
- composer install --no-progress
script:
- vendor/bin/phpunit --testsuite main
stages:
- test
- name: phar
if: (branch = master OR tag IS present) && type = push
jobs:
include:
-
stage: compile
name: "Compile Rector to prefixed PHAR"
php: 7.2
script:
- cd compiler
- composer install
- bin/compile
# run prefixed Rector
- ../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.email "travis@travis-ci.org"
- git config user.name "Travis CI"
- git add rector rector.phar
- git commit -m "Updated Rector to commit ${TRAVIS_COMMIT}"
- git push --quiet origin master
# Stage 1
-
stage: test
php: 7.2
name: "7.2 with Lowest dependencies"
install:
# install lowest dependencies
- composer update --prefer-lowest --no-progress
-
name: PHPStan
php: 7.2
script:
- composer phpstan
-
php: 7.2
name: ECS
script:
- composer check-cs
-
php: 7.3
name: Rector
script:
- composer rector
-
php: 7.3
name: "Scan Fatal Errors"
script:
- bin/rector scan-fatal-errors tests/Source/FatalErrors
-
name: Documentation
php: 7.2
script:
- composer check-docs
-
name: Simple checks
php: 7.2
script:
- php ci/check_services_in_yaml_configs.php
- php ci/run_all_sets.php
-
# 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 -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: coverage
php: 7.3
name: Test Coverage
if: branch = master AND type = push
before_install:
- echo "keep xdebug"
script:
- vendor/bin/phpunit --coverage-clover coverage.xml
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
- php php-coveralls.phar --verbose
# Windows
- &STANDARD_WINDOWS_JOB
stage: test
name: Windows PHP 7.2
os: windows
dist: '1803-containers'
language: sh # No PHP currently
env: PHP_VERSION=7.2.23
install:
- choco install php --version=${PHP_VERSION} --package-parameters="/InstallDir:c:\tools\php"
- choco install composer --ia "/DEV=C:\tools\php"
- echo 'memory_limit=1G' >> 'C:\tools\php\php.ini'
- echo 'date.timezone="UTC"' >> 'C:\tools\php\php.ini'
- echo 'extension_dir=ext' >> 'C:\tools\php\php.ini'
- echo 'extension=php_mbstring.dll' >> 'C:\tools\php\php.ini'
- echo 'extension=php_openssl.dll' >> 'C:\tools\php\php.ini'
- echo 'extension=php_mysqli.dll' >> 'C:\tools\php\php.ini'
- echo 'extension=php_intl.dll' >> 'C:\tools\php\php.ini'
- export PATH=/c/tools/php:$PATH
script:
# @todo this is probably broken, needs fixing
- php vendor/phpunit/phpunit/phpunit
-
<<: *STANDARD_WINDOWS_JOB
name: Windows PHP 7.3
env: PHP_VERSION=7.3.10
allow_failures:
- name: ECS
- name: Rector
- name: Standalone Run
- name: Documentation
- os: windows
cache:
directories:
- $HOME/.composer/cache
- tmp
notifications:
email: false