Skip to content

rector

rector #33

Workflow file for this run

name: "Continuous Integration"
on:
push:
branches:
- "hotfix/**"
- "release/**"
- "develop"
- "master"
pull_request:
branches:
- "hotfix/**"
- "release/**"
- "develop"
- "master"
jobs:
latest:
name: "Build & Verify"
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
command: update
--with silverstripe/framework:^5.0
php_version: 8.1
php_extensions: xdebug intl
- name: Generate Code Coverage
run: |
XDEBUG_MODE=coverage \
./vendor/bin/phpunit -c phpunit.xml.dist \
--coverage-clover ./coverage.xml
- name: Annotate with Metrics
run: |
find src -name "*.php" | xargs -n 1 ./vendor/bin/metrics annotate ./coverage.xml
- name: Refactor with Rector
run: |
./vendor/bin/rector process src
- name: Tidy Source Code
run: |
find tests -name "*.php" | xargs -n 1 ./vendor/bin/phptidy.php replace
find src -name "*.php" | xargs -n 1 ./vendor/bin/phptidy.php replace
- name: Push Back Changes
run: |
git diff --exit-code src || ( \
git config user.name github-actions && \
git config user.email github-actions@github.com && \
git add src && \
git commit -m "tidy" && \
git fetch --unshallow origin ${{ github.head_ref || github.ref_name }} && \
git push origin HEAD:${{ github.head_ref || github.ref_name }} \
)
matrix:
strategy:
fail-fast: false
matrix:
include:
- operating-system: 'ubuntu-latest'
silverstripe-version: '5.0'
php-version: '8.1'
- operating-system: 'ubuntu-latest'
silverstripe-version: '4.0'
php-version: '8.0'
- operating-system: 'ubuntu-latest'
silverstripe-version: '4.0'
php-version: '7.4'
name: "Matrix: SS ${{ matrix.silverstripe-version }}, PHP ${{ matrix.php-version }}"
runs-on: ${{ matrix.operating-system }}
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
with:
command: update
--with silverstripe/framework:^${{ matrix.silverstripe-version }}
php_version: ${{ matrix.php-version }}
php_extensions: intl
- run: |
./vendor/bin/phpunit -c phpunit.xml.dist
merge:
name: "Merge Changes"
if: github.event_name == 'push'
needs: [latest,matrix]
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- run: |
false || ( \
git config user.name github-actions && \
git config user.email github-actions@github.com && \
git fetch --unshallow origin ${{ github.ref_name }} develop && \
git checkout develop && \
git merge origin/${{ github.ref_name }} && \
git push \
)