1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Enhancement: Run friendsofphp/php-cs-fixer on GitHub Actions

Co-authored-by: Markus Staab <maggus.staab@googlemail.com>

Closes GH-559.
This commit is contained in:
Andreas Möller
2022-07-11 19:19:15 +02:00
committed by GitHub
parent e45bf2b782
commit d3b6b3ed67
7 changed files with 2181 additions and 2 deletions

View File

@@ -67,6 +67,13 @@ about what you're working on, you can contact us via the
```
to check your change doesn't break other features.
- Run
```
make coding-standards
```
to automatically fix coding standard issues.
- Review the change once more just before submitting it.
## What happens after submitting contribution?
@@ -121,6 +128,12 @@ Having said that, here are the organizational rules:
make tests
```
5. Fix coding standard issues before committing code. To do so use
```
make coding-standards
```
6. Use reasonable commit messages.
Thank you for contributing to https://www.php.net!

View File

@@ -9,6 +9,49 @@ on:
- "master"
jobs:
coding-standards:
name: "Coding Standards"
runs-on: "ubuntu-latest"
strategy:
matrix:
php-version:
- "7.3"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
- name: "Set up PHP"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
extensions: "none, json, mbstring, tokenizer"
php-version: "${{ matrix.php-version }}"
- name: "Set up problem matchers for PHP"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
- name: "Validate composer.json and composer.lock"
run: "composer validate --ansi --strict"
- name: "Determine composer cache directory"
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v3"
with:
path: "${{ env.COMPOSER_CACHE_DIR }}"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"
- name: "Install dependencies with composer"
run: "composer install --ansi --no-interaction --no-progress"
- name: "Run friendsofphp/php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose"
tests:
name: "Tests"

2
.gitignore vendored
View File

@@ -4,6 +4,8 @@ backend/mirror.gif
backend/mirror.png
backend/mirror.jpg
backend/GeoIP.dat
vendor/
.idea
.DS_Store
.DS_Store?
.php-cs-fixer.cache

14
.php-cs-fixer.php Normal file
View File

@@ -0,0 +1,14 @@
<?php
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
$config = new PhpCsFixer\Config();
$finder = $config->getFinder()
->ignoreDotFiles(false)
->in(__DIR__)
->name(__FILE__);
$config->setRules([]);
return $config;

View File

@@ -2,6 +2,14 @@
help: ## Displays this list of targets with descriptions
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: coding-standards
coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer
vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose
.PHONY: tests
tests: ## Runs tests
php tests/run-tests.php -j3 -q
vendor: composer.json composer.lock
composer validate --strict
composer install --no-interaction --no-progress

View File

@@ -10,6 +10,9 @@
"require": {
"php": "^7.3"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.4.0"
},
"autoload": {
"psr-4": {
"phpweb\\": "src/"

2100
composer.lock generated

File diff suppressed because it is too large Load Diff