Skip to content

Commit 1dfd33d

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

File tree

11 files changed

+158
-201
lines changed

11 files changed

+158
-201
lines changed

.github/workflows/php.yml

Lines changed: 126 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,8 @@ 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,\
120+
pcre, posix, sodium, spl, xml, zip
230121
tools: composer
231122
ini-values: error_reporting=E_ALL
232123
coverage: none
@@ -250,7 +141,7 @@ jobs:
250141
- name: Cache composer dependencies
251142
uses: actions/cache@v5
252143
with:
253-
path: $COMPOSER_CACHE
144+
path: ${{ env.COMPOSER_CACHE }}
254145
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
255146
restore-keys: ${{ runner.os }}-composer-
256147

@@ -260,6 +151,105 @@ jobs:
260151
- name: Run unit tests
261152
run: vendor/bin/phpunit --no-coverage
262153

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

codecov.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
---
2+
13
coverage:
24
status:
35
project:
46
default:
57
target: 0%
68
threshold: 2%
7-
patch: off
9+
patch: false
810
comment:
911
layout: "diff"
1012
behavior: once

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)