1919 strategy :
2020 fail-fast : false
2121 matrix :
22- php-version : ['8.1 ', '8.2 ', '8.3 ', '8.4 ']
22+ php-version : ['8.2 ', '8.3 ', '8.4 ', '8.5 ']
2323
2424 uses :
simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected] 2525 with :
@@ -37,30 +37,43 @@ jobs:
3737 enable_stylelinter : false
3838 enable_yamllinter : true
3939
40- quality :
41- name : Quality control
42- needs : [unit-tests-linux]
43- runs-on : [ubuntu-latest]
40+ unit-tests-linux :
41+ name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
42+ runs-on : ${{ matrix.operating-system }}
43+ needs : [phplinter, linter]
44+
45+ strategy :
46+ fail-fast : false
47+ matrix :
48+ operating-system : [ubuntu-latest]
49+ php-versions : ['8.2', '8.3', '8.4', '8.5']
4450
4551 steps :
4652 - name : Install libkrb5-dev
4753 run : sudo apt-get install -y libkrb5-dev
4854
4955 - name : Setup PHP, with composer and extensions
50- id : setup-php
5156 # https://github.com/shivammathur/setup-php
5257 uses : shivammathur/setup-php@v2
5358 with :
54- # Should be the higest supported version, so we can use the newest tools
55- php-version : ' 8.4'
56- tools : composer, composer-require-checker, composer-unused, phpcs, psalm
57- # optional performance gain for psalm: opcache
58- extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, opcache, openssl, pcre, spl, xml \
59+ php-version : ${{ matrix.php-versions }}
60+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml \
5961 krb5-php/pecl-authentication-krb5@master
62+ tools : composer
63+ ini-values : error_reporting=E_ALL
64+ coverage : pcov
6065
6166 - name : Setup problem matchers for PHP
6267 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
6368
69+ - name : Setup problem matchers for PHPUnit
70+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
71+
72+ - name : Set git to use LF
73+ run : |
74+ git config --global core.autocrlf false
75+ git config --global core.eol lf
76+
6477 - uses : actions/checkout@v5
6578
6679 - name : Get composer cache directory
@@ -73,66 +86,60 @@ jobs:
7386 key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
7487 restore-keys : ${{ runner.os }}-composer-
7588
76- - name : Validate composer.json and composer.lock
77- run : composer validate
78-
7989 - name : Install Composer dependencies
8090 run : composer install --no-progress --prefer-dist --optimize-autoloader
8191
82- - name : Check code for hard dependencies missing in composer.json
83- run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
84-
85- - name : Check code for unused dependencies in composer.json
86- run : composer-unused
87-
88- - name : PHP Code Sniffer
89- run : phpcs
90-
91- - name : Psalm
92- continue-on-error : true
93- run : |
94- psalm -c psalm.xml \
95- --show-info=true \
96- --shepherd \
97- --php-version=${{ steps.setup-php.outputs.php-version }}
92+ - name : Run unit tests with coverage
93+ if : ${{ matrix.php-versions == '8.5' }}
94+ run : vendor/bin/phpunit
9895
99- - name : Psalm (testsuite)
100- run : |
101- psalm -c psalm-dev.xml \
102- --show-info=true \
103- --shepherd \
104- --php-version=${{ steps.setup-php.outputs.php-version }}
96+ - name : Run unit tests (no coverage)
97+ if : ${{ matrix.php-versions != '8.5' }}
98+ run : vendor/bin/phpunit --no-coverage
10599
106- - name : Psalter
107- run : |
108- psalm --alter \
109- --issues=UnnecessaryVarAnnotation \
110- --dry-run \
111- --php-version= ${{ steps.setup-php.outputs.php-version }}
100+ - name : Save coverage data
101+ if : ${{ matrix.php-versions == '8.5' }}
102+ uses : actions/upload-artifact@v5
103+ with :
104+ name : coverage-data
105+ path : ${{ github.workspace }}/build
112106
113- security :
114- name : Security checks
115- needs : [unit-tests-linux]
116- runs-on : [ubuntu-latest]
107+ unit-tests-windows :
108+ name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
109+ runs-on : ${{ matrix.operating-system }}
110+ needs : [phplinter, linter]
111+ strategy :
112+ fail-fast : true
113+ matrix :
114+ operating-system : [windows-latest]
115+ php-versions : ['8.2', '8.3', '8.4', '8.5']
117116
118117 steps :
119118 - name : Setup PHP, with composer and extensions
120119 # https://github.com/shivammathur/setup-php
121120 uses : shivammathur/setup-php@v2
122121 with :
123- # Should be the lowest supported version
124- php-version : ' 8.1'
125- extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml
122+ php-version : ${{ matrix.php-versions }}
123+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml, zip
126124 tools : composer
125+ ini-values : error_reporting=E_ALL
127126 coverage : none
128127
129128 - name : Setup problem matchers for PHP
130129 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
131130
131+ - name : Setup problem matchers for PHPUnit
132+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
133+
134+ - name : Set git to use LF
135+ run : |
136+ git config --global core.autocrlf false
137+ git config --global core.eol lf
138+
132139 - uses : actions/checkout@v5
133140
134141 - name : Get composer cache directory
135- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
142+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env: GITHUB_ENV"
136143
137144 - name : Cache composer dependencies
138145 uses : actions/cache@v4
@@ -144,52 +151,33 @@ jobs:
144151 - name : Install Composer dependencies
145152 run : composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req ext-krb5
146153
147- - name : Security check for locked dependencies
148- run : composer audit
149-
150- - name : Update Composer dependencies
151- run : composer update --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req ext-krb5
152-
153- - name : Security check for updated dependencies
154- run : composer audit
155-
156- unit-tests-linux :
157- name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
158- runs-on : ${{ matrix.operating-system }}
159- needs : [phplinter, linter]
154+ - name : Run unit tests
155+ run : vendor/bin/phpunit --no-coverage
160156
161- strategy :
162- fail-fast : false
163- matrix :
164- operating-system : [ubuntu-latest]
165- php-versions : ['8.1', '8.2', '8.3', '8.4']
157+ quality :
158+ name : Quality control
159+ needs : [unit-tests-linux]
160+ runs-on : [ubuntu-latest]
166161
167162 steps :
168163 - name : Install libkrb5-dev
169164 run : sudo apt-get install -y libkrb5-dev
170165
171166 - name : Setup PHP, with composer and extensions
167+ id : setup-php
172168 # https://github.com/shivammathur/setup-php
173169 uses : shivammathur/setup-php@v2
174170 with :
175- php-version : ${{ matrix.php-versions }}
176- extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml \
171+ # Should be the higest supported version, so we can use the newest tools
172+ php-version : ' 8.5'
173+ tools : composer, composer-require-checker, composer-unused, phpcs, psalm
174+ # optional performance gain for psalm: opcache
175+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, opcache, openssl, pcre, spl, xml \
177176 krb5-php/pecl-authentication-krb5@master
178- tools : composer
179- ini-values : error_reporting=E_ALL
180- coverage : pcov
181177
182178 - name : Setup problem matchers for PHP
183179 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
184180
185- - name : Setup problem matchers for PHPUnit
186- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
187-
188- - name : Set git to use LF
189- run : |
190- git config --global core.autocrlf false
191- git config --global core.eol lf
192-
193181 - uses : actions/checkout@v5
194182
195183 - name : Get composer cache directory
@@ -202,60 +190,66 @@ jobs:
202190 key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
203191 restore-keys : ${{ runner.os }}-composer-
204192
193+ - name : Validate composer.json and composer.lock
194+ run : composer validate
195+
205196 - name : Install Composer dependencies
206197 run : composer install --no-progress --prefer-dist --optimize-autoloader
207198
208- - name : Run unit tests with coverage
209- if : ${{ matrix.php-versions == '8.4' }}
210- run : vendor/bin/phpunit
199+ - name : Check code for hard dependencies missing in composer.json
200+ run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
211201
212- - name : Run unit tests (no coverage)
213- if : ${{ matrix.php-versions != '8.4' }}
214- run : vendor/bin/phpunit --no-coverage
202+ - name : Check code for unused dependencies in composer.json
203+ run : composer-unused
215204
216- - name : Save coverage data
217- if : ${{ matrix.php-versions == '8.4' }}
218- uses : actions/upload-artifact@v5
219- with :
220- name : coverage-data
221- path : ${{ github.workspace }}/build
205+ - name : PHP Code Sniffer
206+ run : phpcs
222207
223- unit-tests-windows :
224- name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
225- runs-on : ${{ matrix.operating-system }}
226- needs : [phplinter, linter]
227- strategy :
228- fail-fast : true
229- matrix :
230- operating-system : [windows-latest]
231- php-versions : ['8.1', '8.2', '8.3', '8.4']
208+ - name : Psalm
209+ continue-on-error : true
210+ run : |
211+ psalm -c psalm.xml \
212+ --show-info=true \
213+ --shepherd \
214+ --php-version=${{ steps.setup-php.outputs.php-version }}
215+
216+ - name : Psalm (testsuite)
217+ run : |
218+ psalm -c psalm-dev.xml \
219+ --show-info=true \
220+ --shepherd \
221+ --php-version=${{ steps.setup-php.outputs.php-version }}
222+
223+ - name : Psalter
224+ run : |
225+ psalm --alter \
226+ --issues=UnnecessaryVarAnnotation \
227+ --dry-run \
228+ --php-version=${{ steps.setup-php.outputs.php-version }}
229+
230+ security :
231+ name : Security checks
232+ needs : [unit-tests-linux]
233+ runs-on : [ubuntu-latest]
232234
233235 steps :
234236 - name : Setup PHP, with composer and extensions
235237 # https://github.com/shivammathur/setup-php
236238 uses : shivammathur/setup-php@v2
237239 with :
238- php-version : ${{ matrix.php-versions }}
239- extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml, zip
240+ # Should be the lowest supported version
241+ php-version : ' 8.2'
242+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, openssl, pcre, spl, xml
240243 tools : composer
241- ini-values : error_reporting=E_ALL
242244 coverage : none
243245
244246 - name : Setup problem matchers for PHP
245247 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
246248
247- - name : Setup problem matchers for PHPUnit
248- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
249-
250- - name : Set git to use LF
251- run : |
252- git config --global core.autocrlf false
253- git config --global core.eol lf
254-
255249 - uses : actions/checkout@v5
256250
257251 - name : Get composer cache directory
258- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env: GITHUB_ENV"
252+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
259253
260254 - name : Cache composer dependencies
261255 uses : actions/cache@v4
@@ -267,8 +261,14 @@ jobs:
267261 - name : Install Composer dependencies
268262 run : composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req ext-krb5
269263
270- - name : Run unit tests
271- run : vendor/bin/phpunit --no-coverage
264+ - name : Security check for locked dependencies
265+ run : composer audit
266+
267+ - name : Update Composer dependencies
268+ run : composer update --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req ext-krb5
269+
270+ - name : Security check for updated dependencies
271+ run : composer audit
272272
273273 coverage :
274274 name : Code coverage
0 commit comments