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:
13
.github/CONTRIBUTING.md
vendored
13
.github/CONTRIBUTING.md
vendored
@@ -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!
|
||||
|
||||
43
.github/workflows/integrate.yaml
vendored
43
.github/workflows/integrate.yaml
vendored
@@ -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
2
.gitignore
vendored
@@ -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
14
.php-cs-fixer.php
Normal 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;
|
||||
8
Makefile
8
Makefile
@@ -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
|
||||
|
||||
@@ -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
2100
composer.lock
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user