@@ -14,131 +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@v5
23- with :
24- # super-linter needs the full git history to get the
25- # list of files that changed across commits
26- fetch-depth : 0
27-
28- - name : Lint Code Base
29- uses : super-linter/super-linter/slim@v8
30- env :
31- SAVE_SUPER_LINTER_OUTPUT : false
32- # To report GitHub Actions status checks
33- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
34- LINTER_RULES_PATH : ' tools/linters'
35- LOG_LEVEL : NOTICE
36- VALIDATE_ALL_CODEBASE : true
37- VALIDATE_JSON : true
38- VALIDATE_PHP_BUILTIN : true
39- VALIDATE_YAML : true
40- VALIDATE_XML : true
41- VALIDATE_GITHUB_ACTIONS : true
42-
43- quality :
44- name : Quality control
45- runs-on : [ubuntu-latest]
46-
47- steps :
48- - name : Setup PHP, with composer and extensions
49- id : setup-php
50- # https://github.com/shivammathur/setup-php
51- uses : shivammathur/setup-php@v2
52- with :
53- # Should be the higest supported version, so we can use the newest tools
54- php-version : ' 8.3'
55- tools : composer, composer-require-checker, composer-unused, phpcs, psalm
56- # optional performance gain for psalm: opcache
57- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
58-
59- - name : Setup problem matchers for PHP
60- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
61-
62- - uses : actions/checkout@v5
63-
64- - name : Get composer cache directory
65- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
66-
67- - name : Cache composer dependencies
68- uses : actions/cache@v4
69- with :
70- path : $COMPOSER_CACHE
71- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
72- restore-keys : ${{ runner.os }}-composer-
73-
74- - name : Validate composer.json and composer.lock
75- run : composer validate
76-
77- - name : Install Composer dependencies
78- run : composer install --no-progress --prefer-dist --optimize-autoloader
79-
80- - name : Check code for hard dependencies missing in composer.json
81- run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
82-
83- - name : Check code for unused dependencies in composer.json
84- run : composer-unused
85-
86- - name : PHP Code Sniffer
87- run : phpcs
88-
89- - name : PHPStan
90- run : |
91- vendor/bin/phpstan analyze -c phpstan.neon
92-
93- - name : PHPStan (testsuite)
94- run : |
95- vendor/bin/phpstan analyze -c phpstan-dev.neon
96-
97- security :
98- name : Security checks
99- runs-on : [ubuntu-latest]
100- steps :
101- - name : Setup PHP, with composer and extensions
102- # https://github.com/shivammathur/setup-php
103- uses : shivammathur/setup-php@v2
104- with :
105- # Should be the lowest supported version
106- php-version : ' 8.1'
107- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
108- tools : composer
109- coverage : none
110-
111- - name : Setup problem matchers for PHP
112- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
113-
114- - uses : actions/checkout@v5
115-
116- - name : Get composer cache directory
117- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
118-
119- - name : Cache composer dependencies
120- uses : actions/cache@v4
121- with :
122- path : $COMPOSER_CACHE
123- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
124- restore-keys : ${{ runner.os }}-composer-
125-
126- - name : Install Composer dependencies
127- 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']
12823
129- - name : Security check for locked dependencies
130- run : composer audit
24+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.3
25+ with :
26+ php-version : ${{ matrix.php-version }}
13127
132- - name : Update Composer dependencies
133- run : composer update --no-progress --prefer-dist --optimize-autoloader
28+ linter :
29+ name : ' Linter'
30+ strategy :
31+ fail-fast : false
13432
135- - name : Security check for updated dependencies
136- run : composer audit
33+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.3
34+ with :
35+ enable_eslinter : false
36+ enable_jsonlinter : true
37+ enable_stylelinter : false
38+ enable_yamllinter : true
13739
13840 unit-tests-linux :
13941 name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
14042 runs-on : ${{ matrix.operating-system }}
141- needs : [linter, quality, security ]
43+ needs : [phplinter, linter, quality ]
14244 strategy :
14345 fail-fast : false
14446 matrix :
@@ -200,7 +102,7 @@ jobs:
200102 unit-tests-windows :
201103 name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
202104 runs-on : ${{ matrix.operating-system }}
203- needs : [linter, quality, security ]
105+ needs : [phplinter, linter ]
204106 strategy :
205107 fail-fast : true
206108 matrix :
@@ -247,10 +149,109 @@ jobs:
247149 - name : Run unit tests
248150 run : vendor/bin/phpunit --no-coverage
249151
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, psalm
166+ # optional performance gain for psalm: opcache
167+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
168+
169+ - name : Setup problem matchers for PHP
170+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
171+
172+ - uses : actions/checkout@v5
173+
174+ - name : Get composer cache directory
175+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
176+
177+ - name : Cache composer dependencies
178+ uses : actions/cache@v4
179+ with :
180+ path : $COMPOSER_CACHE
181+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
182+ restore-keys : ${{ runner.os }}-composer-
183+
184+ - name : Validate composer.json and composer.lock
185+ run : composer validate
186+
187+ - name : Install Composer dependencies
188+ run : composer install --no-progress --prefer-dist --optimize-autoloader
189+
190+ - name : Check code for hard dependencies missing in composer.json
191+ run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
192+
193+ - name : Check code for unused dependencies in composer.json
194+ run : composer-unused
195+
196+ - name : PHP Code Sniffer
197+ run : phpcs
198+
199+ - name : PHPStan
200+ run : |
201+ vendor/bin/phpstan analyze -c phpstan.neon
202+
203+ - name : PHPStan (testsuite)
204+ run : |
205+ vendor/bin/phpstan analyze -c phpstan-dev.neon
206+
207+ security :
208+ name : Security checks
209+ runs-on : [ubuntu-latest]
210+ needs : [unit-tests-linux]
211+
212+ steps :
213+ - name : Setup PHP, with composer and extensions
214+ # https://github.com/shivammathur/setup-php
215+ uses : shivammathur/setup-php@v2
216+ with :
217+ # Should be the lowest supported version
218+ php-version : ' 8.1'
219+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
220+ tools : composer
221+ coverage : none
222+
223+ - name : Setup problem matchers for PHP
224+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
225+
226+ - uses : actions/checkout@v5
227+
228+ - name : Get composer cache directory
229+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
230+
231+ - name : Cache composer dependencies
232+ uses : actions/cache@v4
233+ with :
234+ path : $COMPOSER_CACHE
235+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
236+ restore-keys : ${{ runner.os }}-composer-
237+
238+ - name : Install Composer dependencies
239+ run : composer install --no-progress --prefer-dist --optimize-autoloader
240+
241+ - name : Security check for locked dependencies
242+ run : composer audit
243+
244+ - name : Update Composer dependencies
245+ run : composer update --no-progress --prefer-dist --optimize-autoloader
246+
247+ - name : Security check for updated dependencies
248+ run : composer audit
249+
250250 coverage :
251251 name : Code coverage
252252 runs-on : [ubuntu-latest]
253253 needs : [unit-tests-linux]
254+
254255 steps :
255256 - uses : actions/checkout@v5
256257
@@ -268,8 +269,9 @@ jobs:
268269
269270 cleanup :
270271 name : Cleanup artifacts
271- needs : [unit-tests-linux, coverage]
272272 runs-on : [ubuntu-latest]
273+ needs : [unit-tests-linux, coverage]
274+
273275 if : |
274276 always() &&
275277 needs.coverage.result == 'success' ||
0 commit comments