mirror of
https://github.com/rectorphp/rector.git
synced 2025-04-22 16:32:27 +02:00
use Github Actions to compile and publish prefixed rector.phar, coverage and the rest
This commit is contained in:
parent
3f805d93c3
commit
aa4d0017d0
@ -3,7 +3,6 @@
|
||||
|
||||
.env
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
.editorconfig
|
||||
.phpstorm.meta.php
|
||||
|
||||
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
168
.github/workflows/code_checks.yml
vendored
168
.github/workflows/code_checks.yml
vendored
@ -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'
|
||||
|
65
.github/workflows/rector_phar.yml
vendored
Normal file
65
.github/workflows/rector_phar.yml
vendored
Normal file
@ -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 }}
|
43
.github/workflows/standalone_run.yml
vendored
Normal file
43
.github/workflows/standalone_run.yml
vendored
Normal file
@ -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
|
119
.travis.yml
119
.travis.yml
@ -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
|
@ -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?
|
||||
|
||||
[](https://travis-ci.org/rectorphp/rector)
|
||||
[](https://github.com/rectorphp/rector/actions)
|
||||
[](https://coveralls.io/github/rectorphp/rector?branch=master)
|
||||
[](https://packagist.org/packages/rector/rector)
|
||||
|
Loading…
x
Reference in New Issue
Block a user