@@ -14,130 +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- # 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@v7
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
56- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, soap, spl, xml
57-
58- - name : Setup problem matchers for PHP
59- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
60-
61- - uses : actions/checkout@v4
62-
63- - name : Get composer cache directory
64- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
65-
66- - name : Cache composer dependencies
67- uses : actions/cache@v4
68- with :
69- path : $COMPOSER_CACHE
70- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
71- restore-keys : ${{ runner.os }}-composer-
72-
73- - name : Validate composer.json and composer.lock
74- run : composer validate
75-
76- - name : Install Composer dependencies
77- run : composer install --no-progress --prefer-dist --optimize-autoloader
78-
79- - name : Check code for hard dependencies missing in composer.json
80- run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
81-
82- - name : Check code for unused dependencies in composer.json
83- run : composer-unused
84-
85- - name : PHP Code Sniffer
86- run : phpcs
87-
88- - name : PHPStan
89- run : |
90- vendor/bin/phpstan analyze -c phpstan.neon
91-
92- - name : PHPStan (testsuite)
93- run : |
94- vendor/bin/phpstan analyze -c phpstan-dev.neon
95-
96- security :
97- name : Security checks
98- runs-on : [ubuntu-latest]
99- steps :
100- - name : Setup PHP, with composer and extensions
101- # https://github.com/shivammathur/setup-php
102- uses : shivammathur/setup-php@v2
103- with :
104- # Should be the lowest supported version
105- php-version : ' 8.1'
106- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, soap, spl, xml
107- tools : composer
108- coverage : none
109-
110- - name : Setup problem matchers for PHP
111- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
112-
113- - uses : actions/checkout@v4
114-
115- - name : Get composer cache directory
116- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
117-
118- - name : Cache composer dependencies
119- uses : actions/cache@v4
120- with :
121- path : $COMPOSER_CACHE
122- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
123- restore-keys : ${{ runner.os }}-composer-
124-
125- - name : Install Composer dependencies
126- 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']
12723
128- - name : Security check for locked dependencies
129- 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 }}
13027
131- - name : Update Composer dependencies
132- run : composer update --no-progress --prefer-dist --optimize-autoloader
28+ linter :
29+ name : ' Linter'
30+ strategy :
31+ fail-fast : false
13332
134- - name : Security check for updated dependencies
135- 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
13639
13740 unit-tests-linux :
13841 name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
13942 runs-on : ${{ matrix.operating-system }}
140- needs : [linter, quality, security ]
43+ needs : [phplinter, linter ]
14144 strategy :
14245 fail-fast : false
14346 matrix :
@@ -199,7 +102,7 @@ jobs:
199102 unit-tests-windows :
200103 name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
201104 runs-on : ${{ matrix.operating-system }}
202- needs : [linter, quality, security ]
105+ needs : [phplinter, linter ]
203106 strategy :
204107 fail-fast : true
205108 matrix :
@@ -246,6 +149,102 @@ jobs:
246149 - name : Run unit tests
247150 run : vendor/bin/phpunit --no-coverage
248151
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, openssl, pcre, posix, soap, 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
201+
202+ - name : PHPStan (testsuite)
203+ run : |
204+ vendor/bin/phpstan analyze -c phpstan-dev.neon
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, posix, soap, 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+
249248 coverage :
250249 name : Code coverage
251250 runs-on : [ubuntu-latest]
0 commit comments