Skip to content

Commit d9eed1c

Browse files
committed
Enhancement: Run friendsofphp/php-cs-fixer on GitHub Actions
1 parent d47ac32 commit d9eed1c

File tree

5 files changed

+2160
-2
lines changed

5 files changed

+2160
-2
lines changed

.github/workflows/integrate.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,49 @@ on:
99
- "master"
1010

1111
jobs:
12+
coding-standards:
13+
name: "Coding Standards"
14+
15+
runs-on: "ubuntu-latest"
16+
17+
strategy:
18+
matrix:
19+
php-version:
20+
- "7.3"
21+
22+
steps:
23+
- name: "Checkout"
24+
uses: "actions/checkout@v3"
25+
26+
- name: "Set up PHP"
27+
uses: "shivammathur/setup-php@v2"
28+
with:
29+
coverage: "none"
30+
extensions: "none, json, mbstring, tokenizer"
31+
php-version: "${{ matrix.php-version }}"
32+
33+
- name: "Set up problem matchers for PHP"
34+
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\""
35+
36+
- name: "Validate composer.json and composer.lock"
37+
run: "composer validate --ansi --strict"
38+
39+
- name: "Determine composer cache directory"
40+
run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV"
41+
42+
- name: "Cache dependencies installed with composer"
43+
uses: "actions/cache@v3"
44+
with:
45+
path: "${{ env.COMPOSER_CACHE_DIR }}"
46+
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('composer.lock') }}"
47+
restore-keys: "php-${{ matrix.php-version }}-composer-"
48+
49+
- name: "Install dependencies with composer"
50+
run: "composer install --ansi --no-interaction --no-progress"
51+
52+
- name: "Run friendsofphp/php-cs-fixer"
53+
run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose"
54+
1255
tests:
1356
name: "Tests"
1457

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ backend/mirror.gif
44
backend/mirror.png
55
backend/mirror.jpg
66
backend/GeoIP.dat
7+
vendor/
78
.idea
89
.DS_Store
910
.DS_Store?
11+
.php-cs-fixer.cache

.php-cs-fixer.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()->in(__DIR__);
4+
5+
$config = new PhpCsFixer\Config();
6+
7+
$finder = $config->getFinder()
8+
->ignoreDotFiles(false)
9+
->in(__DIR__)
10+
->name('.php-cs-fixer.php');
11+
12+
$config->setRules([]);
13+
14+
return $config;

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"require": {
1111
"php": "^7.3"
1212
},
13+
"require-dev": {
14+
"friendsofphp/php-cs-fixer": "^3.4.0"
15+
},
1316
"config": {
1417
"platform": {
1518
"php": "7.3.19"

0 commit comments

Comments
 (0)