Skip to content

Commit 5a7b0b8

Browse files
committed
Bump minimum PHP version and fix composer cache
1 parent 1fae2a1 commit 5a7b0b8

File tree

8 files changed

+147
-197
lines changed

8 files changed

+147
-197
lines changed

.github/workflows/php.yml

Lines changed: 125 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -14,144 +14,34 @@ on: # yamllint disable-line rule:truthy
1414
workflow_dispatch:
1515

1616
jobs:
17-
linter:
18-
name: Linter
19-
runs-on: ['ubuntu-latest']
20-
21-
steps:
22-
- uses: actions/checkout@v6
23-
with:
24-
fetch-depth: 0
25-
26-
- name: Lint Code Base
27-
uses: super-linter/super-linter/slim@v8
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_PHP_BUILTIN: true
38-
VALIDATE_YAML: true
39-
VALIDATE_XML: true
40-
VALIDATE_GITHUB_ACTIONS: true
41-
42-
quality:
43-
name: Quality control
44-
runs-on: [ubuntu-latest]
45-
46-
steps:
47-
- name: Setup PHP, with composer and extensions
48-
id: setup-php
49-
# https://github.com/shivammathur/setup-php
50-
uses: shivammathur/setup-php@v2
51-
with:
52-
# Should be the higest supported version, so we can use the newest tools
53-
php-version: '8.5'
54-
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
55-
# optional performance gain for psalm: opcache
56-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
57-
58-
- name: Setup problem matchers for PHP
59-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
60-
61-
- uses: actions/checkout@v6
62-
63-
- name: Get composer cache directory
64-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
65-
66-
- name: Cache composer dependencies
67-
uses: actions/cache@v5
68-
with:
69-
path: $COMPOSER_CACHE
70-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
71-
restore-keys: ${{ runner.os }}-composer-
72-
73-
- name: Validate composer.json and composer.lock
74-
run: composer validate
75-
76-
- name: Install Composer dependencies
77-
run: composer install --no-progress --prefer-dist --optimize-autoloader
78-
79-
- name: Check code for hard dependencies missing in composer.json
80-
run: composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
81-
82-
- name: Check code for unused dependencies in composer.json
83-
run: composer-unused
84-
85-
- name: PHP Code Sniffer
86-
run: phpcs
87-
88-
- name: Psalm
89-
continue-on-error: true
90-
run: |
91-
psalm -c psalm.xml \
92-
--show-info=true \
93-
--shepherd \
94-
--php-version=${{ steps.setup-php.outputs.php-version }}
95-
96-
- name: Psalm (testsuite)
97-
run: |
98-
psalm -c psalm-dev.xml \
99-
--show-info=true \
100-
--shepherd \
101-
--php-version=${{ steps.setup-php.outputs.php-version }}
102-
103-
- name: Psalter
104-
run: |
105-
psalm --alter \
106-
--issues=UnnecessaryVarAnnotation \
107-
--dry-run \
108-
--php-version=${{ steps.setup-php.outputs.php-version }}
109-
110-
security:
111-
name: Security checks
112-
runs-on: [ubuntu-latest]
113-
steps:
114-
- name: Setup PHP, with composer and extensions
115-
# https://github.com/shivammathur/setup-php
116-
uses: shivammathur/setup-php@v2
117-
with:
118-
# Should be the lowest supported version
119-
php-version: '8.1'
120-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
121-
tools: composer
122-
coverage: none
123-
124-
- name: Setup problem matchers for PHP
125-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
126-
127-
- uses: actions/checkout@v6
128-
129-
- name: Get composer cache directory
130-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
131-
132-
- name: Cache composer dependencies
133-
uses: actions/cache@v5
134-
with:
135-
path: $COMPOSER_CACHE
136-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
137-
restore-keys: ${{ runner.os }}-composer-
138-
139-
- name: Install Composer dependencies
140-
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.3', '8.4', '8.5']
14123

142-
- name: Security check for locked dependencies
143-
run: composer audit
24+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
25+
with:
26+
php-version: ${{ matrix.php-version }}
14427

145-
- name: Update Composer dependencies
146-
run: composer update --no-progress --prefer-dist --optimize-autoloader
28+
linter:
29+
name: 'Linter'
30+
strategy:
31+
fail-fast: false
14732

148-
- name: Security check for updated dependencies
149-
run: composer audit
33+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
34+
with:
35+
enable_eslinter: false
36+
enable_jsonlinter: true
37+
enable_stylelinter: false
38+
enable_yamllinter: true
15039

15140
unit-tests-linux:
15241
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
15342
runs-on: ${{ matrix.operating-system }}
154-
needs: [linter, quality, security]
43+
needs: [phplinter, linter]
44+
15545
strategy:
15646
fail-fast: false
15747
matrix:
@@ -164,7 +54,7 @@ jobs:
16454
uses: shivammathur/setup-php@v2
16555
with:
16656
php-version: ${{ matrix.php-versions }}
167-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
57+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, sodium, spl, xml
16858
tools: composer
16959
ini-values: error_reporting=E_ALL
17060
coverage: pcov
@@ -188,7 +78,7 @@ jobs:
18878
- name: Cache composer dependencies
18979
uses: actions/cache@v5
19080
with:
191-
path: $COMPOSER_CACHE
81+
path: ${{ env.COMPOSER_CACHE }}
19282
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
19383
restore-keys: ${{ runner.os }}-composer-
19484

@@ -213,7 +103,7 @@ jobs:
213103
unit-tests-windows:
214104
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
215105
runs-on: ${{ matrix.operating-system }}
216-
needs: [linter, quality, security]
106+
needs: [phplinter, linter]
217107
strategy:
218108
fail-fast: true
219109
matrix:
@@ -226,7 +116,7 @@ jobs:
226116
uses: shivammathur/setup-php@v2
227117
with:
228118
php-version: ${{ matrix.php-versions }}
229-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
119+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, sodium, spl, xml
230120
tools: composer
231121
ini-values: error_reporting=E_ALL
232122
coverage: none
@@ -250,7 +140,7 @@ jobs:
250140
- name: Cache composer dependencies
251141
uses: actions/cache@v5
252142
with:
253-
path: $COMPOSER_CACHE
143+
path: ${{ env.COMPOSER_CACHE }}
254144
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
255145
restore-keys: ${{ runner.os }}-composer-
256146

@@ -260,6 +150,105 @@ jobs:
260150
- name: Run unit tests
261151
run: vendor/bin/phpunit --no-coverage
262152

153+
quality:
154+
name: Quality control
155+
needs: [unit-tests-linux]
156+
runs-on: [ubuntu-latest]
157+
158+
steps:
159+
- name: Setup PHP, with composer and extensions
160+
id: setup-php
161+
# https://github.com/shivammathur/setup-php
162+
uses: shivammathur/setup-php@v2
163+
with:
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
167+
# optional performance gain for psalm: opcache
168+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl,\
169+
pcre, posix, sodium, spl, xml
170+
171+
- name: Setup problem matchers for PHP
172+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
173+
174+
- uses: actions/checkout@v6
175+
176+
- name: Get composer cache directory
177+
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
178+
179+
- name: Cache composer dependencies
180+
uses: actions/cache@v5
181+
with:
182+
path: ${{ env.COMPOSER_CACHE }}
183+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
184+
restore-keys: ${{ runner.os }}-composer-
185+
186+
- name: Validate composer.json and composer.lock
187+
run: composer validate
188+
189+
- name: Install Composer dependencies
190+
run: composer install --no-progress --prefer-dist --optimize-autoloader
191+
192+
- name: Check code for hard dependencies missing in composer.json
193+
run: composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
194+
195+
- name: Check code for unused dependencies in composer.json
196+
run: composer-unused
197+
198+
- name: PHP Code Sniffer
199+
run: vandor/bin/phpcs
200+
201+
- name: PHPStan
202+
run: |
203+
vendor/bin/phpstan analyze -c phpstan.neon --debug
204+
205+
- name: PHPStan (testsuite)
206+
run: |
207+
vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
208+
209+
security:
210+
name: Security checks
211+
needs: [unit-tests-linux]
212+
runs-on: [ubuntu-latest]
213+
214+
steps:
215+
- name: Setup PHP, with composer and extensions
216+
# https://github.com/shivammathur/setup-php
217+
uses: shivammathur/setup-php@v2
218+
with:
219+
# Should be the lowest supported version
220+
php-version: '8.3'
221+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, sodium, spl, xml
222+
tools: composer
223+
coverage: none
224+
225+
- name: Setup problem matchers for PHP
226+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
227+
228+
- uses: actions/checkout@v6
229+
230+
- name: Get composer cache directory
231+
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
232+
233+
- name: Cache composer dependencies
234+
uses: actions/cache@v5
235+
with:
236+
path: ${{ env.COMPOSER_CACHE }}
237+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
238+
restore-keys: ${{ runner.os }}-composer-
239+
240+
- name: Install Composer dependencies
241+
run: composer install --no-progress --prefer-dist --optimize-autoloader
242+
243+
- name: Security check for locked dependencies
244+
run: composer audit
245+
246+
- name: Update Composer dependencies
247+
run: composer update --no-progress --prefer-dist --optimize-autoloader
248+
249+
- name: Security check for updated dependencies
250+
run: composer audit
251+
263252
coverage:
264253
name: Code coverage
265254
runs-on: [ubuntu-latest]

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636
"require": {
3737
"php": "^8.3",
3838

39-
"simplesamlphp/simplesamlphp": "~2.4",
40-
"symfony/http-foundation": "~7.4"
39+
"simplesamlphp/simplesamlphp": "^2.5@dev",
40+
"symfony/http-foundation": "^7.4"
4141
},
4242
"require-dev": {
43-
"simplesamlphp/simplesamlphp-test-framework": "~1.11"
43+
"simplesamlphp/simplesamlphp-test-framework": "^1.11"
4444
},
4545
"support": {
4646
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-preprodwarning/issues",

phpstan-dev.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 5
3+
paths:
4+
- tests

phpstan.neon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
parameters:
2+
level: 6
3+
paths:
4+
- src

psalm-dev.xml

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)