@@ -2,8 +2,6 @@ name: "Coding Standards"
22
33on :
44 push :
5- branches :
6- tags :
75 pull_request :
86
97env :
1513 name : " phpcs"
1614 runs-on : " ubuntu-22.04"
1715
16+ permissions :
17+ # Give the default GITHUB_TOKEN write permission to commit and push the
18+ # added or changed files to the repository.
19+ contents : write
20+
1821 steps :
1922 - name : " Checkout"
2023 uses : " actions/checkout@v4"
5053 with :
5154 composer-options : " --no-suggest"
5255
56+ - name : " Format the code"
57+ continue-on-error : true
58+ run : |
59+ mkdir .cache
60+ ./vendor/bin/phpcbf
61+
5362 # The -q option is required until phpcs v4 is released
5463 - name : " Run PHP_CodeSniffer"
5564 run : " vendor/bin/phpcs -q --no-colors --report=checkstyle | cs2pr"
65+
66+ - name : " Commit the changes"
67+ uses : stefanzweifel/git-auto-commit-action@v5
68+ with :
69+ commit_message : " apply phpcbf formatting"
70+
71+ analysis :
72+ runs-on : " ubuntu-22.04"
73+ continue-on-error : true
74+ strategy :
75+ matrix :
76+ php :
77+ - ' 8.1'
78+ - ' 8.2'
79+ steps :
80+ - name : Checkout
81+ uses : actions/checkout@v4
82+
83+ - name : Setup PHP
84+ uses : shivammathur/setup-php@v2
85+ with :
86+ php-version : ${{ matrix.php }}
87+ extensions : curl, mbstring
88+ tools : composer:v2
89+ coverage : none
90+
91+ - name : Cache dependencies
92+ id : composer-cache
93+ uses : actions/cache@v3
94+ with :
95+ path : ./vendor
96+ key : composer-${{ hashFiles('**/composer.lock') }}
97+
98+ - name : Install dependencies
99+ run : composer install
100+
101+ - name : Restore cache PHPStan results
102+ id : phpstan-cache-restore
103+ uses : actions/cache/restore@v3
104+ with :
105+ path : .cache
106+ key : " phpstan-result-cache-${{ github.run_id }}"
107+ restore-keys : |
108+ phpstan-result-cache-
109+
110+ - name : Run PHPStan
111+ run : ./vendor/bin/phpstan analyse --no-interaction --no-progress --ansi
112+
113+ - name : Save cache PHPStan results
114+ id : phpstan-cache-save
115+ if : always()
116+ uses : actions/cache/save@v3
117+ with :
118+ path : .cache
119+ key : ${{ steps.phpstan-cache-restore.outputs.cache-primary-key }}
0 commit comments