diff --git a/.dockerignore b/.dockerignore index ea060b1681b..4869ec6e1eb 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,7 +3,6 @@ .env .gitlab-ci.yml -.travis.yml .editorconfig .phpstorm.meta.php diff --git a/.gitattributes b/.gitattributes index 7f1a32e68ae..296db01ffb5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,6 @@ # Remove files for archives generated using `git archive` .coveralls.yml export-ignore -.travis.yml export-ignore .editorconfig export-ignore .gitattributes export-ignore .gitignore export-ignore diff --git a/.github/workflows/code_checks.yml b/.github/workflows/code_checks.yml index 791b44bd4e2..99685c5af54 100644 --- a/.github/workflows/code_checks.yml +++ b/.github/workflows/code_checks.yml @@ -1,93 +1,135 @@ name: Code_Checks on: - pull_request: + pull_request: null push: branches: - master jobs: - phpstan: - name: PHPStan + tests: + runs-on: ubuntu-latest + strategy: + matrix: + php: ['7.3', '7.4'] + + name: PHP ${{ matrix.php }} tests + steps: + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: vendor/bin/phpunit + + test_lowest_dependencies: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v1 - with: - php-version: 7.2 - coverage: none # disable xdebug, pcov - - run: | - composer install --no-progress - composer phpstan + - uses: actions/checkout@v2 + - run: git fetch --depth=100000 origin + + # see https://github.com/shivammathur/setup-php + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none + + - run: composer update --no-progress --prefer-lowest + - run: vendor/bin/phpunit + + phpstan: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: composer phpstan ecs: - name: ECS runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v1 - with: - php-version: 7.2 - coverage: none # disable xdebug, pcov - - run: | - composer install --no-progress - composer check-cs + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: composer check-cs rector: - name: Rector runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v1 - with: - php-version: 7.3 - coverage: none # disable xdebug, pcov - - run: | - composer install --no-progress - composer rector + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.3 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: composer rector docs: - name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v1 - with: - php-version: 7.2 - coverage: none # disable xdebug, pcov - - run: | - composer install --no-progress - composer check-docs + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: composer check-docs - simple-checks: - name: Simple checks + simple_checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v1 - with: - php-version: 7.2 - coverage: none # disable xdebug, pcov - - run: | - composer install --no-progress + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: | php ci/check_services_in_yaml_configs.php php ci/run_all_sets.php - fatal-scan: - name: Scan Fatal Errors + fatal_scan: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Setup PHP - uses: shivammathur/setup-php@v1 - with: - php-version: 7.3 - coverage: none # disable xdebug, pcov - - run: | - composer install --no-progress - bin/rector scan-fatal-errors tests/Source/FatalErrors + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.3 + coverage: none # disable xdebug, pcov + - run: composer install --no-progress + - run: bin/rector scan-fatal-errors tests/Source/FatalErrors + + code_coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + uses: shivammathur/setup-php@v1 + with: + php-version: 7.3 + coverage: none # disable xdebug, pcov + + - run: composer install --no-progress + + - run: | + 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 + env: + COVERALLS_REPO_TOKEN: 'Ew7FYsOKM3T3s1nEsPHJkSe6jdVIFHME8' diff --git a/.github/workflows/rector_phar.yml b/.github/workflows/rector_phar.yml new file mode 100644 index 00000000000..335bf4464fb --- /dev/null +++ b/.github/workflows/rector_phar.yml @@ -0,0 +1,65 @@ +name: Rector_PHAR + +on: + pull_request: + push: + branches: + - master + +jobs: + # see https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32163/highlight/true#M1024 + get_tag: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Get the version + id: get_tag + run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) + + compile_and_deploy_rector_phar: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + + - run: | + cd compiler + composer install + + - run: | + cd compiler + bin/compile + + - run: | + # remove local vendor, to prevent duplicated content + rm -rf vendor + # remove local phpstan.neon, that loads just removed configs + rm phpstan.neon + tmp/rector.phar + + - + name: '' + run: | + git clone https://${ACCESS_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 [ "${CURRENT_TAG}" != "" ]; then COMMIT_MSG="Rector ${CURRENT_TAG}"; else COMMIT_MSG="Updated Rector to commit ${GITHUB_SHA}"; fi + + git commit -m "${COMMIT_MSG}" + git push --quiet origin master + + if [ "${CURRENT_TAG}" != "" ]; then git tag "${CURRENT_TAG}" && git push --quiet origin ${CURRENT_TAG}; fi + + env: + ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} + CURRENT_TAG: ${{ steps.get_tag.outputs.VERSION }} diff --git a/.github/workflows/standalone_run.yml b/.github/workflows/standalone_run.yml new file mode 100644 index 00000000000..8c7aee78af7 --- /dev/null +++ b/.github/workflows/standalone_run.yml @@ -0,0 +1,43 @@ +name: Standalone_Run + +on: + pull_request: null + push: + branches: + - master + +jobs: + standalone_run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: shivammathur/setup-php@v1 + with: + php-version: 7.2 + coverage: none # disable xdebug, pcov + extensions: "intl" + + # Run standalone install in non-root package, ref https://github.com/rectorphp/rector/issues/732 + - run: | + # 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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 318b4cd2c37..00000000000 --- a/.travis.yml +++ /dev/null @@ -1,119 +0,0 @@ -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 diff --git a/README.md b/README.md index d4805317889..27716a26e4d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ Rector is a **rec**onstruc**tor** tool - it does **instant upgrades** and **instant refactoring** of your code. Why refactor manually if Rector can handle 80% for you? -[![Build Status with Travis CI](https://img.shields.io/travis/rectorphp/rector/master.svg?style=flat-square)](https://travis-ci.org/rectorphp/rector) [![Build Status Github Actions](https://img.shields.io/github/workflow/status/rectorphp/rector/Code_Checks?style=flat-square)](https://github.com/rectorphp/rector/actions) [![Coverage Status](https://img.shields.io/coveralls/rectorphp/rector/master.svg?style=flat-square)](https://coveralls.io/github/rectorphp/rector?branch=master) [![Downloads](https://img.shields.io/packagist/dt/rector/rector.svg?style=flat-square)](https://packagist.org/packages/rector/rector)