@@ -14,29 +14,140 @@ 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.9.2
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
32+
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
39+
40+ unit-tests-linux :
41+ name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
42+ runs-on : ${{ matrix.operating-system }}
43+ needs : [linter, quality, security]
44+ strategy :
45+ fail-fast : false
46+ matrix :
47+ operating-system : [ubuntu-latest]
48+ php-versions : ['8.1', '8.2', '8.3', '8.4']
2049
2150 steps :
51+ - name : Setup PHP, with composer and extensions
52+ # https://github.com/shivammathur/setup-php
53+ uses : shivammathur/setup-php@v2
54+ with :
55+ php-version : ${{ matrix.php-versions }}
56+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
57+ tools : composer
58+ ini-values : error_reporting=E_ALL
59+ coverage : pcov
60+
61+ - name : Setup problem matchers for PHP
62+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
63+
64+ - name : Setup problem matchers for PHPUnit
65+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
66+
67+ - name : Set git to use LF
68+ run : |
69+ git config --global core.autocrlf false
70+ git config --global core.eol lf
71+
2272 - uses : actions/checkout@v4
73+
74+ - name : Get composer cache directory
75+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
76+
77+ - name : Cache composer dependencies
78+ uses : actions/cache@v4
2379 with :
24- fetch-depth : 0
25-
26- - name : Lint Code Base
27- uses : super-linter/super-linter/slim@v7
28- env :
29- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30- LINTER_RULES_PATH : ' tools/linters'
31- LOG_LEVEL : NOTICE
32- VALIDATE_ALL_CODEBASE : true
33- VALIDATE_CSS : true
34- VALIDATE_JAVASCRIPT_ES : true
35- VALIDATE_JSON : true
36- VALIDATE_PHP_BUILTIN : true
37- VALIDATE_YAML : true
38- VALIDATE_XML : true
39- VALIDATE_GITHUB_ACTIONS : true
80+ path : $COMPOSER_CACHE
81+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
82+ restore-keys : ${{ runner.os }}-composer-
83+
84+ - name : Install Composer dependencies
85+ run : composer install --no-progress --prefer-dist --optimize-autoloader
86+
87+ - name : Run unit tests with coverage
88+ if : ${{ matrix.php-versions == '8.4' }}
89+ run : vendor/bin/phpunit
90+
91+ - name : Run unit tests (no coverage)
92+ if : ${{ matrix.php-versions != '8.4' }}
93+ run : vendor/bin/phpunit --no-coverage
94+
95+ - name : Save coverage data
96+ if : ${{ matrix.php-versions == '8.4' }}
97+ uses : actions/upload-artifact@v4
98+ with :
99+ name : coverage-data
100+ path : ${{ github.workspace }}/build
101+
102+ unit-tests-windows :
103+ name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
104+ runs-on : ${{ matrix.operating-system }}
105+ needs : [phplinter, linter]
106+ strategy :
107+ fail-fast : true
108+ matrix :
109+ operating-system : [windows-latest]
110+ php-versions : ['8.1', '8.2', '8.3', '8.4']
111+
112+ steps :
113+ - name : Setup PHP, with composer and extensions
114+ # https://github.com/shivammathur/setup-php
115+ uses : shivammathur/setup-php@v2
116+ with :
117+ php-version : ${{ matrix.php-versions }}
118+ extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
119+ tools : composer
120+ ini-values : error_reporting=E_ALL
121+ coverage : none
122+
123+ - name : Setup problem matchers for PHP
124+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
125+
126+ - name : Setup problem matchers for PHPUnit
127+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
128+
129+ - name : Set git to use LF
130+ run : |
131+ git config --global core.autocrlf false
132+ git config --global core.eol lf
133+
134+ - uses : actions/checkout@v4
135+
136+ - name : Get composer cache directory
137+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
138+
139+ - name : Cache composer dependencies
140+ uses : actions/cache@v4
141+ with :
142+ path : $COMPOSER_CACHE
143+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
144+ restore-keys : ${{ runner.os }}-composer-
145+
146+ - name : Install Composer dependencies
147+ run : composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req=ext-posix
148+
149+ - name : Run unit tests
150+ run : vendor/bin/phpunit --no-coverage
40151
41152 quality :
42153 name : Quality control
49160 uses : shivammathur/setup-php@v2
50161 with :
51162 # Should be the higest supported version, so we can use the newest tools
52- php-version : ' 8.3 '
163+ php-version : ' 8.4 '
53164 tools : composer, composer-require-checker, composer-unused, phpcs, psalm
54165 # optional performance gain for psalm: opcache
55166 extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
@@ -147,118 +258,6 @@ jobs:
147258 - name : Security check for updated dependencies
148259 run : composer audit
149260
150- unit-tests-linux :
151- name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
152- runs-on : ${{ matrix.operating-system }}
153- needs : [linter, quality, security]
154- strategy :
155- fail-fast : false
156- matrix :
157- operating-system : [ubuntu-latest]
158- php-versions : ['8.1', '8.2', '8.3']
159-
160- steps :
161- - name : Setup PHP, with composer and extensions
162- # https://github.com/shivammathur/setup-php
163- uses : shivammathur/setup-php@v2
164- with :
165- php-version : ${{ matrix.php-versions }}
166- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
167- tools : composer
168- ini-values : error_reporting=E_ALL
169- coverage : pcov
170-
171- - name : Setup problem matchers for PHP
172- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
173-
174- - name : Setup problem matchers for PHPUnit
175- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
176-
177- - name : Set git to use LF
178- run : |
179- git config --global core.autocrlf false
180- git config --global core.eol lf
181-
182- - uses : actions/checkout@v4
183-
184- - name : Get composer cache directory
185- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
186-
187- - name : Cache composer dependencies
188- uses : actions/cache@v4
189- with :
190- path : $COMPOSER_CACHE
191- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
192- restore-keys : ${{ runner.os }}-composer-
193-
194- - name : Install Composer dependencies
195- run : composer install --no-progress --prefer-dist --optimize-autoloader
196-
197- - name : Run unit tests with coverage
198- if : ${{ matrix.php-versions == '8.3' }}
199- run : vendor/bin/phpunit
200-
201- - name : Run unit tests (no coverage)
202- if : ${{ matrix.php-versions != '8.3' }}
203- run : vendor/bin/phpunit --no-coverage
204-
205- - name : Save coverage data
206- if : ${{ matrix.php-versions == '8.3' }}
207- uses : actions/upload-artifact@v4
208- with :
209- name : coverage-data
210- path : ${{ github.workspace }}/build
211-
212- unit-tests-windows :
213- name : " Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
214- runs-on : ${{ matrix.operating-system }}
215- needs : [linter, quality, security]
216- strategy :
217- fail-fast : true
218- matrix :
219- operating-system : [windows-latest]
220- php-versions : ['8.1', '8.2', '8.3']
221-
222- steps :
223- - name : Setup PHP, with composer and extensions
224- # https://github.com/shivammathur/setup-php
225- uses : shivammathur/setup-php@v2
226- with :
227- php-version : ${{ matrix.php-versions }}
228- extensions : ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
229- tools : composer
230- ini-values : error_reporting=E_ALL
231- coverage : none
232-
233- - name : Setup problem matchers for PHP
234- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
235-
236- - name : Setup problem matchers for PHPUnit
237- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
238-
239- - name : Set git to use LF
240- run : |
241- git config --global core.autocrlf false
242- git config --global core.eol lf
243-
244- - uses : actions/checkout@v4
245-
246- - name : Get composer cache directory
247- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
248-
249- - name : Cache composer dependencies
250- uses : actions/cache@v4
251- with :
252- path : $COMPOSER_CACHE
253- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
254- restore-keys : ${{ runner.os }}-composer-
255-
256- - name : Install Composer dependencies
257- run : composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req=ext-posix
258-
259- - name : Run unit tests
260- run : vendor/bin/phpunit --no-coverage
261-
262261 coverage :
263262 name : Code coverage
264263 runs-on : [ubuntu-latest]
0 commit comments