@@ -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@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_BASH : true
38- VALIDATE_BASH_EXEC : true
39- VALIDATE_JSON : true
40- VALIDATE_YAML : 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.4'
55- tools : composer, composer-require-checker, composer-unused, phpcs
56- extensions : ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml
57- coverage : none
58-
59- - name : Setup problem matchers for PHP
60- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
61-
62- - uses : actions/checkout@v4
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, filter, hash, mbstring, openssl, pcre, soap, 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@v4
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.2
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.2
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 ]
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,6 +149,101 @@ 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+
156+ steps :
157+ - name : Setup PHP, with composer and extensions
158+ id : setup-php
159+ # https://github.com/shivammathur/setup-php
160+ uses : shivammathur/setup-php@v2
161+ with :
162+ # Should be the higest supported version, so we can use the newest tools
163+ php-version : ' 8.4'
164+ tools : composer, composer-require-checker, composer-unused, phpcs
165+ extensions : ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml
166+ coverage : none
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+ steps :
210+ - name : Setup PHP, with composer and extensions
211+ # https://github.com/shivammathur/setup-php
212+ uses : shivammathur/setup-php@v2
213+ with :
214+ # Should be the lowest supported version
215+ php-version : ' 8.1'
216+ extensions : ctype, date, dom, filter, hash, mbstring, openssl, pcre, soap, spl, xml
217+ tools : composer
218+ coverage : none
219+
220+ - name : Setup problem matchers for PHP
221+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
222+
223+ - uses : actions/checkout@v4
224+
225+ - name : Get composer cache directory
226+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
227+
228+ - name : Cache composer dependencies
229+ uses : actions/cache@v4
230+ with :
231+ path : $COMPOSER_CACHE
232+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
233+ restore-keys : ${{ runner.os }}-composer-
234+
235+ - name : Install Composer dependencies
236+ run : composer install --no-progress --prefer-dist --optimize-autoloader
237+
238+ - name : Security check for locked dependencies
239+ run : composer audit
240+
241+ - name : Update Composer dependencies
242+ run : composer update --no-progress --prefer-dist --optimize-autoloader
243+
244+ - name : Security check for updated dependencies
245+ run : composer audit
246+
250247 coverage :
251248 name : Code coverage
252249 runs-on : [ubuntu-latest]
0 commit comments