@@ -14,129 +14,33 @@ on: # yamllint disable-line rule:truthy
1414 workflow_dispatch :
1515
1616jobs :
17- linter :
18- name : Linter
19- runs-on : ['ubuntu-latest']
20-
21- steps :
22- - uses : actions/checkout@v4
23- with :
24- fetch-depth : 0
25-
26- - name : Lint Code Base
27- uses : super-linter/super-linter/slim@v7
28- env :
29- SAVE_SUPER_LINTER_OUTPUT : false
30- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31- LINTER_RULES_PATH : ' tools/linters'
32- LOG_LEVEL : NOTICE
33- VALIDATE_ALL_CODEBASE : true
34- VALIDATE_CSS : true
35- VALIDATE_JAVASCRIPT_ES : true
36- VALIDATE_JSON : true
37- VALIDATE_PHP_BUILTIN : true
38- VALIDATE_YAML : true
39- VALIDATE_XML : true
40- VALIDATE_GITHUB_ACTIONS : true
41-
42- quality :
43- name : Quality control
44- runs-on : [ubuntu-latest]
45-
46- steps :
47- - name : Setup PHP, with composer and extensions
48- id : setup-php
49- # https://github.com/shivammathur/setup-php
50- uses : shivammathur/setup-php@v2
51- with :
52- # Should be the higest supported version, so we can use the newest tools
53- php-version : ' 8.3'
54- tools : composer, composer-require-checker, composer-unused, phpcs
55- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml
56-
57- - name : Setup problem matchers for PHP
58- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
59-
60- - uses : actions/checkout@v4
61-
62- - name : Get composer cache directory
63- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
64-
65- - name : Cache composer dependencies
66- uses : actions/cache@v4
67- with :
68- path : $COMPOSER_CACHE
69- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
70- restore-keys : ${{ runner.os }}-composer-
71-
72- - name : Validate composer.json and composer.lock
73- run : composer validate
74-
75- - name : Install Composer dependencies
76- run : composer install --no-progress --prefer-dist --optimize-autoloader
77-
78- - name : Check code for hard dependencies missing in composer.json
79- run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
80-
81- - name : Check code for unused dependencies in composer.json
82- run : composer-unused
83-
84- - name : PHP Code Sniffer
85- run : phpcs
86-
87- - name : PHPStan
88- run : |
89- vendor/bin/phpstan analyze -c phpstan.neon --debug
90-
91- - name : PHPStan (testsuite)
92- run : |
93- vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
94-
95- security :
96- name : Security checks
97- runs-on : [ubuntu-latest]
98- steps :
99- - name : Setup PHP, with composer and extensions
100- # https://github.com/shivammathur/setup-php
101- uses : shivammathur/setup-php@v2
102- with :
103- # Should be the lowest supported version
104- php-version : ' 8.1'
105- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
106- tools : composer
107- coverage : none
108-
109- - name : Setup problem matchers for PHP
110- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
111-
112- - uses : actions/checkout@v4
113-
114- - name : Get composer cache directory
115- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
116-
117- - name : Cache composer dependencies
118- uses : actions/cache@v4
119- with :
120- path : $COMPOSER_CACHE
121- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
122- restore-keys : ${{ runner.os }}-composer-
123-
124- - name : Install Composer dependencies
125- run : composer install --no-progress --prefer-dist --optimize-autoloader
17+ phplinter :
18+ name : ' PHP-Linter'
19+ strategy :
20+ fail-fast : false
21+ matrix :
22+ php-version : ['8.1', '8.2', '8.3', '8.4']
12623
127- - name : Security check for locked dependencies
128- run : composer audit
24+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.2
25+ with :
26+ php-version : ${{ matrix.php-version }}
12927
130- - name : Update Composer dependencies
131- run : composer update --no-progress --prefer-dist --optimize-autoloader
28+ linter :
29+ name : ' Linter'
30+ strategy :
31+ fail-fast : false
13232
133- - name : Security check for updated dependencies
134- run : composer audit
33+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.2
34+ with :
35+ enable_eslinter : true
36+ enable_jsonlinter : true
37+ enable_stylelinter : true
38+ enable_yamllinter : true
13539
13640 unit-tests-linux :
13741 name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
13842 runs-on : ${{ matrix.operating-system }}
139- needs : [linter, quality, security ]
43+ needs : [phplinter, linter ]
14044 strategy :
14145 fail-fast : false
14246 matrix :
@@ -198,7 +102,7 @@ jobs:
198102 unit-tests-windows :
199103 name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
200104 runs-on : ${{ matrix.operating-system }}
201- needs : [linter, quality, security ]
105+ needs : [phplinter, linter ]
202106 strategy :
203107 fail-fast : true
204108 matrix :
@@ -245,6 +149,102 @@ jobs:
245149 - name : Run unit tests
246150 run : vendor/bin/phpunit --no-coverage
247151
152+ quality :
153+ name : Quality control
154+ runs-on : [ubuntu-latest]
155+ needs : [unit-tests-linux]
156+
157+ steps :
158+ - name : Setup PHP, with composer and extensions
159+ id : setup-php
160+ # https://github.com/shivammathur/setup-php
161+ uses : shivammathur/setup-php@v2
162+ with :
163+ # Should be the higest supported version, so we can use the newest tools
164+ php-version : ' 8.3'
165+ tools : composer, composer-require-checker, composer-unused, phpcs
166+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml
167+
168+ - name : Setup problem matchers for PHP
169+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
170+
171+ - uses : actions/checkout@v4
172+
173+ - name : Get composer cache directory
174+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
175+
176+ - name : Cache composer dependencies
177+ uses : actions/cache@v4
178+ with :
179+ path : $COMPOSER_CACHE
180+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
181+ restore-keys : ${{ runner.os }}-composer-
182+
183+ - name : Validate composer.json and composer.lock
184+ run : composer validate
185+
186+ - name : Install Composer dependencies
187+ run : composer install --no-progress --prefer-dist --optimize-autoloader
188+
189+ - name : Check code for hard dependencies missing in composer.json
190+ run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
191+
192+ - name : Check code for unused dependencies in composer.json
193+ run : composer-unused
194+
195+ - name : PHP Code Sniffer
196+ run : phpcs
197+
198+ - name : PHPStan
199+ run : |
200+ vendor/bin/phpstan analyze -c phpstan.neon --debug
201+
202+ - name : PHPStan (testsuite)
203+ run : |
204+ vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
205+
206+ security :
207+ name : Security checks
208+ runs-on : [ubuntu-latest]
209+ needs : [unit-tests-linux]
210+ steps :
211+ - name : Setup PHP, with composer and extensions
212+ # https://github.com/shivammathur/setup-php
213+ uses : shivammathur/setup-php@v2
214+ with :
215+ # Should be the lowest supported version
216+ php-version : ' 8.1'
217+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
218+ tools : composer
219+ coverage : none
220+
221+ - name : Setup problem matchers for PHP
222+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
223+
224+ - uses : actions/checkout@v4
225+
226+ - name : Get composer cache directory
227+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
228+
229+ - name : Cache composer dependencies
230+ uses : actions/cache@v4
231+ with :
232+ path : $COMPOSER_CACHE
233+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
234+ restore-keys : ${{ runner.os }}-composer-
235+
236+ - name : Install Composer dependencies
237+ run : composer install --no-progress --prefer-dist --optimize-autoloader
238+
239+ - name : Security check for locked dependencies
240+ run : composer audit
241+
242+ - name : Update Composer dependencies
243+ run : composer update --no-progress --prefer-dist --optimize-autoloader
244+
245+ - name : Security check for updated dependencies
246+ run : composer audit
247+
248248 coverage :
249249 name : Code coverage
250250 runs-on : [ubuntu-latest]
0 commit comments