Skip to content

Commit f58a15c

Browse files
authored
Add workflow for linting framework (codeigniter4#4958)
1 parent e6fddba commit f58a15c

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Coding Standards
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'spark'
8+
- '.github/workflows/test-coding-standards.yml'
9+
pull_request:
10+
paths:
11+
- '**.php'
12+
- 'spark'
13+
- '.github/workflows/test-coding-standards.yml'
14+
15+
jobs:
16+
lint:
17+
name: PHP ${{ matrix.php-version }} Lint with PHP CS Fixer
18+
runs-on: ubuntu-20.04
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
php-version:
24+
- '7.3'
25+
- '7.4'
26+
- '8.0'
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v2
31+
32+
- name: Setup PHP
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
php-version: ${{ matrix.php-version }}
36+
extensions: tokenizer
37+
coverage: none
38+
39+
- name: Get composer cache directory
40+
id: composer-cache
41+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
42+
43+
- name: Cache dependencies
44+
uses: actions/cache@v2
45+
with:
46+
path: ${{ steps.composer-cache.outputs.dir }}
47+
key: ${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
48+
restore-keys: |
49+
${{ runner.os }}-${{ matrix.php-version }}-
50+
${{ runner.os }}-
51+
52+
- name: Install dependencies
53+
run: composer update --ansi --no-interaction
54+
55+
- name: Run lint on `app/`, `admin/`, `public/`
56+
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --config=.no-header.php-cs-fixer.dist.php --using-cache=no --diff
57+
58+
- name: Run lint on `system/`, `tests`, `utils/`, and root PHP files
59+
run: vendor/bin/php-cs-fixer fix --verbose --ansi --dry-run --using-cache=no --diff

0 commit comments

Comments
 (0)