@@ -14,48 +14,62 @@ on: # yamllint disable-line rule:truthy
1414 workflow_dispatch :
1515
1616jobs :
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']
23+
24+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.3
25+ with :
26+ php-version : ${{ matrix.php-version }}
27+
1728 linter :
18- name : Linter
19- runs-on : ['ubuntu-latest']
29+ name : ' Linter'
30+ strategy :
31+ fail-fast : false
2032
21- steps :
22- - uses : actions/checkout@v5
23- with :
24- fetch-depth : 0
25-
26- - name : Lint Code Base
27- uses : github/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_YAML : true
38- VALIDATE_XML : true
39- VALIDATE_GITHUB_ACTIONS : true
33+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.10.3
34+ with :
35+ enable_eslinter : false
36+ enable_jsonlinter : true
37+ enable_stylelinter : false
38+ enable_yamllinter : true
4039
41- quality :
42- name : Quality control
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+ strategy :
45+ fail-fast : false
46+ matrix :
47+ operating-system : [ubuntu-latest]
48+ php-versions : ['8.2', '8.3', '8.4', '8.5']
4449
4550 steps :
4651 - name : Setup PHP, with composer and extensions
47- id : setup-php
4852 # https://github.com/shivammathur/setup-php
4953 uses : shivammathur/setup-php@v2
5054 with :
51- # Should be the higest supported version, so we can use the newest tools
52- php-version : ' 8.4'
53- tools : composer, composer-require-checker, composer-unused
54- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, posix, spl, xml
55+ php-version : ${{ matrix.php-versions }}
56+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre,\
57+ pdo, pdo_sqlite, posix, spl, xml
58+ tools : composer
59+ ini-values : error_reporting=E_ALL
60+ coverage : pcov
5561
5662 - name : Setup problem matchers for PHP
5763 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
5864
65+ - name : Setup problem matchers for PHPUnit
66+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
67+
68+ - name : Set git to use LF
69+ run : |
70+ git config --global core.autocrlf false
71+ git config --global core.eol lf
72+
5973 - uses : actions/checkout@v5
6074
6175 - name : Get composer cache directory
@@ -68,51 +82,61 @@ jobs:
6882 key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
6983 restore-keys : ${{ runner.os }}-composer-
7084
71- - name : Validate composer.json and composer.lock
72- run : composer validate
73-
7485 - name : Install Composer dependencies
7586 run : composer install --no-progress --prefer-dist --optimize-autoloader
7687
77- - name : Check code for hard dependencies missing in composer.json
78- run : composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
79-
80- - name : Check code for unused dependencies in composer.json
81- run : composer-unused
88+ - name : Run unit tests with coverage
89+ if : ${{ matrix.php-versions == '8.5' }}
90+ run : vendor/bin/phpunit
8291
83- - name : PHP Code Sniffer
84- run : |
85- vendor/bin/phpcs
92+ - name : Run unit tests (no coverage)
93+ if : ${{ matrix.php-versions != '8.5' }}
94+ run : vendor/bin/phpunit --no-coverage
8695
87- - name : PHPStan
88- run : |
89- vendor/bin/phpstan analyze -c phpstan.neon --debug
96+ - name : Save coverage data
97+ if : ${{ matrix.php-versions == '8.5' }}
98+ uses : actions/upload-artifact@v4
99+ with :
100+ name : coverage-data
101+ path : ${{ github.workspace }}/build
90102
91- - name : PHPStan (testsuite)
92- run : |
93- vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
103+ unit-tests-windows :
104+ name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
105+ runs-on : ${{ matrix.operating-system }}
106+ needs : [phplinter, linter]
107+ strategy :
108+ fail-fast : true
109+ matrix :
110+ operating-system : [windows-latest]
111+ php-versions : ['8.2', '8.3', '8.4', '8.5']
94112
95- security :
96- name : Security checks
97- runs-on : [ubuntu-latest]
98113 steps :
99114 - name : Setup PHP, with composer and extensions
100115 # https://github.com/shivammathur/setup-php
101116 uses : shivammathur/setup-php@v2
102117 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, pdo, posix, spl, xml
118+ php-version : ${{ matrix.php-versions }}
119+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre,\
120+ pdo, pdo_sqlite, posix, spl, xml, zip
106121 tools : composer
122+ ini-values : error_reporting=E_ALL
107123 coverage : none
108124
109125 - name : Setup problem matchers for PHP
110126 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
111127
128+ - name : Setup problem matchers for PHPUnit
129+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
130+
131+ - name : Set git to use LF
132+ run : |
133+ git config --global core.autocrlf false
134+ git config --global core.eol lf
135+
112136 - uses : actions/checkout@v5
113137
114138 - name : Get composer cache directory
115- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
139+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env: GITHUB_ENV"
116140
117141 - name : Cache composer dependencies
118142 uses : actions/cache@v4
@@ -122,49 +146,29 @@ jobs:
122146 restore-keys : ${{ runner.os }}-composer-
123147
124148 - name : Install Composer dependencies
125- run : composer install --no-progress --prefer-dist --optimize-autoloader
149+ run : composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req=ext-posix
126150
127- - name : Security check for locked dependencies
128- run : composer audit
129-
130- - name : Update Composer dependencies
131- run : composer update --no-progress --prefer-dist --optimize-autoloader
132-
133- - name : Security check for updated dependencies
134- run : composer audit
151+ - name : Run unit tests
152+ run : vendor/bin/phpunit --no-coverage
135153
136- unit-tests-linux :
137- name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
138- runs-on : ${{ matrix.operating-system }}
139- needs : [linter, quality, security]
140- strategy :
141- fail-fast : false
142- matrix :
143- operating-system : [ubuntu-latest]
144- php-versions : ['8.1', '8.2', '8.3', '8.4']
154+ quality :
155+ name : Quality control
156+ runs-on : [ubuntu-latest]
145157
146158 steps :
147159 - name : Setup PHP, with composer and extensions
160+ id : setup-php
148161 # https://github.com/shivammathur/setup-php
149162 uses : shivammathur/setup-php@v2
150163 with :
151- php-version : ${{ matrix.php-versions }}
152- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, pdo_sqlite, posix, spl, xml
153- tools : composer
154- ini-values : error_reporting=E_ALL
155- coverage : pcov
164+ # Should be the higest supported version, so we can use the newest tools
165+ php-version : ' 8.5'
166+ tools : composer, composer-require-checker, composer-unused, phpcs, phpstan
167+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, posix, spl, xml
156168
157169 - name : Setup problem matchers for PHP
158170 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
159171
160- - name : Setup problem matchers for PHPUnit
161- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
162-
163- - name : Set git to use LF
164- run : |
165- git config --global core.autocrlf false
166- git config --global core.eol lf
167-
168172 - uses : actions/checkout@v5
169173
170174 - name : Get composer cache directory
@@ -177,60 +181,50 @@ jobs:
177181 key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
178182 restore-keys : ${{ runner.os }}-composer-
179183
184+ - name : Validate composer.json and composer.lock
185+ run : composer validate
186+
180187 - name : Install Composer dependencies
181188 run : composer install --no-progress --prefer-dist --optimize-autoloader
182189
183- - name : Run unit tests with coverage
184- if : ${{ matrix.php-versions == '8.4' }}
185- run : vendor/bin/phpunit
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
186192
187- - name : Run unit tests (no coverage)
188- if : ${{ matrix.php-versions != '8.4' }}
189- run : vendor/bin/phpunit --no-coverage
193+ - name : Check code for unused dependencies in composer.json
194+ run : composer-unused
190195
191- - name : Save coverage data
192- if : ${{ matrix.php-versions == '8.4' }}
193- uses : actions/upload-artifact@v4
194- with :
195- name : coverage-data
196- path : ${{ github.workspace }}/build
196+ - name : PHP Code Sniffer
197+ run : vendor/bin/phpcs
197198
198- unit-tests-windows :
199- name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
200- runs-on : ${{ matrix.operating-system }}
201- needs : [linter, quality, security]
202- strategy :
203- fail-fast : true
204- matrix :
205- operating-system : [windows-latest]
206- php-versions : ['8.1', '8.2', '8.3', '8.4']
199+ - name : PHPStan
200+ run : |
201+ vendor/bin/phpstan analyze -c phpstan.neon --debug
207202
203+ - name : PHPStan (testsuite)
204+ run : |
205+ vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
206+
207+ security :
208+ name : Security checks
209+ runs-on : [ubuntu-latest]
208210 steps :
209211 - name : Setup PHP, with composer and extensions
210212 # https://github.com/shivammathur/setup-php
211213 uses : shivammathur/setup-php@v2
212214 with :
213- php-version : ${{ matrix.php-versions }}
214- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, pdo_sqlite, posix, spl, xml
215+ # Should be the lowest supported version
216+ php-version : ' 8.2'
217+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, pdo, posix, spl, xml, zip
215218 tools : composer
216- ini-values : error_reporting=E_ALL
217219 coverage : none
218220
219221 - name : Setup problem matchers for PHP
220222 run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
221223
222- - name : Setup problem matchers for PHPUnit
223- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
224-
225- - name : Set git to use LF
226- run : |
227- git config --global core.autocrlf false
228- git config --global core.eol lf
229-
230224 - uses : actions/checkout@v5
231225
232226 - name : Get composer cache directory
233- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env: GITHUB_ENV"
227+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
234228
235229 - name : Cache composer dependencies
236230 uses : actions/cache@v4
@@ -240,10 +234,16 @@ jobs:
240234 restore-keys : ${{ runner.os }}-composer-
241235
242236 - name : Install Composer dependencies
243- run : composer install --no-progress --optimize-autoloader --ignore-platform-req=ext-posix
237+ run : composer install --no-progress --prefer-dist -- optimize-autoloader --ignore-platform-req=ext-posix
244238
245- - name : Run unit tests
246- run : vendor/bin/phpunit --no-coverage
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
247247
248248 coverage :
249249 name : Code coverage
0 commit comments