@@ -13,32 +13,150 @@ on: # yamllint disable-line rule:truthy
1313 - ' **.md'
1414
1515jobs :
16+ phplinter :
17+ name : ' PHP-Linter'
18+ strategy :
19+ fail-fast : false
20+ matrix :
21+ php-version : ['8.1', '8.2', '8.3', '8.4']
22+
23+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.2
24+ with :
25+ php-version : ${{ matrix.php-version }}
26+
1627 linter :
17- name : Linter
18- runs-on : ['ubuntu-latest']
28+ name : ' Linter'
29+ strategy :
30+ fail-fast : false
31+
32+ uses : simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.2
33+ with :
34+ enable_eslinter : true
35+ enable_jsonlinter : true
36+ enable_stylelinter : true
37+ enable_yamllinter : true
38+
39+ unit-tests-linux :
40+ name : " Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
41+ runs-on : ${{ matrix.operating-system }}
42+ needs : [phplinter, linter]
43+ strategy :
44+ fail-fast : false
45+ matrix :
46+ operating-system : [ubuntu-latest]
47+ php-versions : ['8.1', '8.2', '8.3']
48+
49+ steps :
50+ - name : Setup PHP, with composer and extensions
51+ # https://github.com/shivammathur/setup-php
52+ uses : shivammathur/setup-php@v2
53+ with :
54+ php-version : ${{ matrix.php-versions }}
55+ extensions : intl, mbstring, mysql, pdo, pdo_sqlite, soap, xml
56+ tools : composer:v2
57+ ini-values : error_reporting=E_ALL
58+ coverage : xdebug
59+
60+ - name : Setup problem matchers for PHP
61+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
62+
63+ - name : Setup problem matchers for PHPUnit
64+ run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
65+
66+ - name : Set git to use LF
67+ run : |
68+ git config --global core.autocrlf false
69+ git config --global core.eol lf
70+
71+ - uses : actions/checkout@v4
72+
73+ - name : Copy config.php.dist to config.php
74+ run : cp config/config.php.dist config/config.php
75+
76+ - name : Create SimpleSAMLphp cache directory
77+ run : sudo mkdir -p /var/cache/simplesamlphp && sudo chmod 777 /var/cache/simplesamlphp
78+
79+ - name : Get composer cache directory
80+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
81+
82+ - name : Cache composer dependencies
83+ uses : actions/cache@v4
84+ with :
85+ path : $COMPOSER_CACHE
86+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
87+ restore-keys : ${{ runner.os }}-composer-
88+
89+ - name : Install Composer dependencies
90+ run : composer install --no-progress --prefer-dist --optimize-autoloader
91+
92+ - name : Run unit tests with coverage
93+ if : ${{ matrix.php-versions == '8.1' }}
94+ run : ./vendor/bin/phpunit
95+
96+ - name : Run unit tests (no coverage)
97+ if : ${{ matrix.php-versions != '8.1' }}
98+ run : ./vendor/bin/phpunit --no-coverage
99+
100+ - name : Save coverage data
101+ if : ${{ matrix.php-versions == '8.1' }}
102+ uses : actions/upload-artifact@v4
103+ with :
104+ name : coverage-data
105+ path : ${{ github.workspace }}/build
106+
107+ unit-tests-windows :
108+ name : " Syntax and 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.1', '8.2', '8.3']
19116
20117 steps :
118+ - name : Setup PHP, with composer and extensions
119+ # https://github.com/shivammathur/setup-php
120+ uses : shivammathur/setup-php@v2
121+ with :
122+ php-version : ${{ matrix.php-versions }}
123+ extensions : intl, mbstring, mysql, pdo, pdo_sqlite, soap, xml
124+ tools : composer:v2
125+ ini-values : error_reporting=E_ALL
126+ coverage : none
127+
128+ - name : Setup problem matchers for PHP
129+ run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
130+
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+
21139 - uses : actions/checkout@v4
140+
141+ - name : Get composer cache directory
142+ run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
143+
144+ - name : Cache composer dependencies
145+ uses : actions/cache@v4
22146 with :
23- fetch-depth : 0
24-
25- - name : Lint Code Base
26- uses : super-linter/super-linter/slim@v6
27- env :
28- # To report GitHub Actions status checks
29- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30- LOG_LEVEL : NOTICE
31- VALIDATE_ALL_CODEBASE : true
32- LINTER_RULES_PATH : ' tools/linters'
33- VALIDATE_CSS : true
34- VALIDATE_JAVASCRIPT_ES : true
35- VALIDATE_JSON : true
36- VALIDATE_PHP_BUILTIN : true
37- VALIDATE_YAML : true
38- VALIDATE_GITHUB_ACTIONS : true
147+ path : $COMPOSER_CACHE
148+ key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
149+ restore-keys : ${{ runner.os }}-composer-
150+
151+ - name : Install Composer dependencies
152+ run : composer install --no-progress --prefer-dist --optimize-autoloader --no-scripts
153+
154+ - name : Run unit tests
155+ run : ./vendor/bin/phpunit --no-coverage
39156
40157 quality :
41158 name : Quality control
159+ needs : [unit-tests-linux]
42160 runs-on : [ubuntu-latest]
43161
44162 steps :
@@ -107,6 +225,7 @@ jobs:
107225
108226 security :
109227 name : Security checks
228+ needs : [unit-tests-linux]
110229 runs-on : [ubuntu-latest]
111230 steps :
112231 - name : Setup PHP, with composer and extensions
@@ -145,118 +264,6 @@ jobs:
145264 - name : Security check for updated dependencies
146265 run : composer audit
147266
148- unit-tests-linux :
149- name : " Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
150- runs-on : ${{ matrix.operating-system }}
151- needs : [linter, quality, security]
152- strategy :
153- fail-fast : false
154- matrix :
155- operating-system : [ubuntu-latest]
156- php-versions : ['8.1', '8.2', '8.3', '8.4']
157-
158- steps :
159- - name : Setup PHP, with composer and extensions
160- # https://github.com/shivammathur/setup-php
161- uses : shivammathur/setup-php@v2
162- with :
163- php-version : ${{ matrix.php-versions }}
164- extensions : intl, mbstring, mysql, pdo, pdo_sqlite, xml
165- tools : composer:v2
166- ini-values : error_reporting=E_ALL
167- coverage : xdebug
168-
169- - name : Setup problem matchers for PHP
170- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
171-
172- - name : Setup problem matchers for PHPUnit
173- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
174-
175- - name : Set git to use LF
176- run : |
177- git config --global core.autocrlf false
178- git config --global core.eol lf
179-
180- - uses : actions/checkout@v4
181-
182- - name : Get composer cache directory
183- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
184-
185- - name : Cache composer dependencies
186- uses : actions/cache@v4
187- with :
188- path : $COMPOSER_CACHE
189- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
190- restore-keys : ${{ runner.os }}-composer-
191-
192- - name : Install Composer dependencies
193- run : composer install --no-progress --prefer-dist --optimize-autoloader
194-
195- - name : Run unit tests with coverage
196- if : ${{ matrix.php-versions == '8.1' }}
197- run : ./vendor/bin/phpunit
198-
199- - name : Run unit tests (no coverage)
200- if : ${{ matrix.php-versions != '8.1' }}
201- run : ./vendor/bin/phpunit --no-coverage
202-
203- - name : Save coverage data
204- if : ${{ matrix.php-versions == '8.1' }}
205- uses : actions/upload-artifact@v4
206- with :
207- name : coverage-data
208- path : ${{ github.workspace }}/build
209-
210- unit-tests-windows :
211- name : " Syntax and unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
212- runs-on : ${{ matrix.operating-system }}
213- needs : [linter, quality, security]
214- strategy :
215- fail-fast : true
216- matrix :
217- operating-system : [windows-latest]
218- php-versions : ['8.1', '8.2', '8.3', '8.4']
219-
220- steps :
221- - name : Setup PHP, with composer and extensions
222- # https://github.com/shivammathur/setup-php
223- uses : shivammathur/setup-php@v2
224- with :
225- php-version : ${{ matrix.php-versions }}
226- extensions : intl, mbstring, mysql, pdo, pdo_sqlite, xml
227- tools : composer:v2
228- ini-values : error_reporting=E_ALL
229- coverage : none
230-
231- - name : Setup problem matchers for PHP
232- run : echo "::add-matcher::${{ runner.tool_cache }}/php.json"
233-
234- - name : Setup problem matchers for PHPUnit
235- run : echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
236-
237- - name : Set git to use LF
238- run : |
239- git config --global core.autocrlf false
240- git config --global core.eol lf
241-
242- - uses : actions/checkout@v4
243-
244- - name : Get composer cache directory
245- run : echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
246-
247- - name : Cache composer dependencies
248- uses : actions/cache@v4
249- with :
250- path : $COMPOSER_CACHE
251- key : ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
252- restore-keys : ${{ runner.os }}-composer-
253-
254- - name : Install Composer dependencies
255- run : composer install --no-progress --prefer-dist --optimize-autoloader
256-
257- - name : Run unit tests
258- run : ./vendor/bin/phpunit --no-coverage
259-
260267 coverage :
261268 name : Code coverage
262269 runs-on : [ubuntu-latest]
0 commit comments