Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add rector refactoring workflow #302

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Our project employs [GitHub Actions](https://github.com/features/actions) for co
| [`coding-standards.yml`](workflows/coding-standards.yml) | Checks `yaml`, `md`, `composer`, `php` and commit coding standards. |
| [`create-release.yml`](workflows/create-release.yml) | Creates a release on GitHub. |
| [`dependency-analysis.yml`](workflows/dependency-analysis.yml) | Checks for dependency issues. |
| [`refactoring.yml`](workflows/refactoring.yml) | Runs rector/rector code check. |
| [`security-analysis.yml`](workflows/security-analysis.yml) | Checks for security issues. |
| [`shellcheck.yml`](workflows/shellcheck.yml) | Checks shell scripts. |
| [`static-analysis.yml`](workflows/static-analysis.yml) | Runs `psalm` and `phpstan` tools. |
Expand Down
Empty file removed .github/assets/.gitkeep
Empty file.
65 changes: 65 additions & 0 deletions .github/workflows/refactoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---

on: # yamllint disable-line rule:truthy
pull_request:
branches:
- master
paths:
- 'src/**'
- 'tests/**'
- '.php-cs-fixer.dist.php'
- 'rector.php'

name: ⚙️ Refactoring

jobs:
refactoring:
timeout-minutes: 4
runs-on: ${{ matrix.os }}
concurrency:
cancel-in-progress: true
group: refactoring-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
php-version:
- '8.1'
dependencies:
- locked
steps:
- name: 📦 Check out the codebase
uses: actions/[email protected]

- name: 🛠️ Setup PHP
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring
ini-values: error_reporting=E_ALL
coverage: none

- name: 🛠️ Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"

- name: 🤖 Validate composer.json and composer.lock
run: composer validate --ansi --strict

- name: 🔍 Get composer cache directory
uses: wayofdev/gh-actions/actions/composer/[email protected]

- name: ♻️ Restore cached dependencies installed with composer
uses: actions/[email protected]
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-

- name: 📥 Install "${{ matrix.dependencies }}" dependencies
uses: wayofdev/gh-actions/actions/composer/[email protected]
with:
dependencies: ${{ matrix.dependencies }}

- name: ⚙️ Run automated refactoring with rector/rector
run: composer refactor:ci
Loading