Skip to content

Commit 2d6dc68

Browse files
committed
Bump minimum PHP version to 8.2 and start testing on PHP 8.5
1 parent e1e8de7 commit 2d6dc68

2 files changed

Lines changed: 119 additions & 119 deletions

File tree

.github/workflows/php.yml

Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
strategy:
2020
fail-fast: false
2121
matrix:
22-
php-version: ['8.1', '8.2', '8.3', '8.4']
22+
php-version: ['8.2', '8.3', '8.4', '8.5']
2323

2424
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.10.3
2525
with:
@@ -37,26 +37,38 @@ jobs:
3737
enable_stylelinter: false
3838
enable_yamllinter: true
3939

40-
quality:
41-
name: Quality control
42-
needs: [unit-tests-linux]
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, phpcs, psalm
54-
# optional performance gain for psalm: opcache
55-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml
55+
php-version: ${{ matrix.php-versions }}
56+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
57+
tools: composer
58+
ini-values: error_reporting=E_ALL
59+
coverage: pcov
5660

5761
- name: Setup problem matchers for PHP
5862
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
5963

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+
6072
- uses: actions/checkout@v5
6173

6274
- name: Get composer cache directory
@@ -69,66 +81,61 @@ jobs:
6981
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
7082
restore-keys: ${{ runner.os }}-composer-
7183

72-
- name: Validate composer.json and composer.lock
73-
run: composer validate
74-
7584
- name: Install Composer dependencies
7685
run: composer install --no-progress --prefer-dist --optimize-autoloader
7786

78-
- name: Check code for hard dependencies missing in composer.json
79-
run: composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
80-
81-
- name: Check code for unused dependencies in composer.json
82-
run: composer-unused
83-
84-
- name: PHP Code Sniffer
85-
run: phpcs
87+
- name: Run unit tests with coverage
88+
if: ${{ matrix.php-versions == '8.5' }}
89+
run: vendor/bin/phpunit
8690

87-
- name: Psalm
88-
continue-on-error: true
89-
run: |
90-
psalm -c psalm.xml \
91-
--show-info=true \
92-
--shepherd \
93-
--php-version=${{ steps.setup-php.outputs.php-version }}
91+
- name: Run unit tests (no coverage)
92+
if: ${{ matrix.php-versions != '8.5' }}
93+
run: vendor/bin/phpunit --no-coverage
9494

95-
- name: Psalm (testsuite)
96-
run: |
97-
psalm -c psalm-dev.xml \
98-
--show-info=true \
99-
--shepherd \
100-
--php-version=${{ steps.setup-php.outputs.php-version }}
95+
- name: Save coverage data
96+
if: ${{ matrix.php-versions == '8.5' }}
97+
uses: actions/upload-artifact@v5
98+
with:
99+
name: coverage-data
100+
path: ${{ github.workspace }}/build
101101

102-
- name: Psalter
103-
run: |
104-
psalm --alter \
105-
--issues=UnnecessaryVarAnnotation \
106-
--dry-run \
107-
--php-version=${{ steps.setup-php.outputs.php-version }}
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]
108106

109-
security:
110-
name: Security checks
111-
needs: [unit-tests-linux]
112-
runs-on: [ubuntu-latest]
107+
strategy:
108+
fail-fast: true
109+
matrix:
110+
operating-system: [windows-latest]
111+
php-versions: ['8.2', '8.3', '8.4', '8.5']
113112

114113
steps:
115114
- name: Setup PHP, with composer and extensions
116115
# https://github.com/shivammathur/setup-php
117116
uses: shivammathur/setup-php@v2
118117
with:
119-
# Should be the lowest supported version
120-
php-version: '8.1'
121-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
118+
php-version: ${{ matrix.php-versions }}
119+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml, zip
122120
tools: composer
121+
ini-values: error_reporting=E_ALL
123122
coverage: none
124123

125124
- name: Setup problem matchers for PHP
126125
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
127126

127+
- name: Setup problem matchers for PHPUnit
128+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
129+
130+
- name: Set git to use LF
131+
run: |
132+
git config --global core.autocrlf false
133+
git config --global core.eol lf
134+
128135
- uses: actions/checkout@v5
129136

130137
- name: Get composer cache directory
131-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
138+
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
132139

133140
- name: Cache composer dependencies
134141
uses: actions/cache@v4
@@ -140,47 +147,29 @@ jobs:
140147
- name: Install Composer dependencies
141148
run: composer install --no-progress --prefer-dist --optimize-autoloader
142149

143-
- name: Security check for locked dependencies
144-
run: composer audit
145-
146-
- name: Update Composer dependencies
147-
run: composer update --no-progress --prefer-dist --optimize-autoloader
148-
149-
- name: Security check for updated dependencies
150-
run: composer audit
150+
- name: Run unit tests
151+
run: vendor/bin/phpunit --no-coverage
151152

152-
unit-tests-linux:
153-
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
154-
runs-on: ${{ matrix.operating-system }}
155-
needs: [phplinter, linter]
156-
strategy:
157-
fail-fast: false
158-
matrix:
159-
operating-system: [ubuntu-latest]
160-
php-versions: ['8.1', '8.2', '8.3', '8.4']
153+
quality:
154+
name: Quality control
155+
needs: [unit-tests-linux]
156+
runs-on: [ubuntu-latest]
161157

162158
steps:
163159
- name: Setup PHP, with composer and extensions
160+
id: setup-php
164161
# https://github.com/shivammathur/setup-php
165162
uses: shivammathur/setup-php@v2
166163
with:
167-
php-version: ${{ matrix.php-versions }}
168-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
169-
tools: composer
170-
ini-values: error_reporting=E_ALL
171-
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, psalm
167+
# optional performance gain for psalm: opcache
168+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml
172169

173170
- name: Setup problem matchers for PHP
174171
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
175172

176-
- name: Setup problem matchers for PHPUnit
177-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
178-
179-
- name: Set git to use LF
180-
run: |
181-
git config --global core.autocrlf false
182-
git config --global core.eol lf
183-
184173
- uses: actions/checkout@v5
185174

186175
- name: Get composer cache directory
@@ -193,61 +182,66 @@ jobs:
193182
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
194183
restore-keys: ${{ runner.os }}-composer-
195184

185+
- name: Validate composer.json and composer.lock
186+
run: composer validate
187+
196188
- name: Install Composer dependencies
197189
run: composer install --no-progress --prefer-dist --optimize-autoloader
198190

199-
- name: Run unit tests with coverage
200-
if: ${{ matrix.php-versions == '8.4' }}
201-
run: vendor/bin/phpunit
191+
- name: Check code for hard dependencies missing in composer.json
192+
run: composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
202193

203-
- name: Run unit tests (no coverage)
204-
if: ${{ matrix.php-versions != '8.4' }}
205-
run: vendor/bin/phpunit --no-coverage
194+
- name: Check code for unused dependencies in composer.json
195+
run: composer-unused
206196

207-
- name: Save coverage data
208-
if: ${{ matrix.php-versions == '8.4' }}
209-
uses: actions/upload-artifact@v5
210-
with:
211-
name: coverage-data
212-
path: ${{ github.workspace }}/build
197+
- name: PHP Code Sniffer
198+
run: phpcs
213199

214-
unit-tests-windows:
215-
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
216-
runs-on: ${{ matrix.operating-system }}
217-
needs: [phplinter, linter]
200+
- name: Psalm
201+
continue-on-error: true
202+
run: |
203+
psalm -c psalm.xml \
204+
--show-info=true \
205+
--shepherd \
206+
--php-version=${{ steps.setup-php.outputs.php-version }}
218207
219-
strategy:
220-
fail-fast: true
221-
matrix:
222-
operating-system: [windows-latest]
223-
php-versions: ['8.1', '8.2', '8.3', '8.4']
208+
- name: Psalm (testsuite)
209+
run: |
210+
psalm -c psalm-dev.xml \
211+
--show-info=true \
212+
--shepherd \
213+
--php-version=${{ steps.setup-php.outputs.php-version }}
214+
215+
- name: Psalter
216+
run: |
217+
psalm --alter \
218+
--issues=UnnecessaryVarAnnotation \
219+
--dry-run \
220+
--php-version=${{ steps.setup-php.outputs.php-version }}
221+
222+
security:
223+
name: Security checks
224+
needs: [unit-tests-linux]
225+
runs-on: [ubuntu-latest]
224226

225227
steps:
226228
- name: Setup PHP, with composer and extensions
227229
# https://github.com/shivammathur/setup-php
228230
uses: shivammathur/setup-php@v2
229231
with:
230-
php-version: ${{ matrix.php-versions }}
231-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml, zip
232+
# Should be the lowest supported version
233+
php-version: '8.2'
234+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, spl, xml
232235
tools: composer
233-
ini-values: error_reporting=E_ALL
234236
coverage: none
235237

236238
- name: Setup problem matchers for PHP
237239
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
238240

239-
- name: Setup problem matchers for PHPUnit
240-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
241-
242-
- name: Set git to use LF
243-
run: |
244-
git config --global core.autocrlf false
245-
git config --global core.eol lf
246-
247241
- uses: actions/checkout@v5
248242

249243
- name: Get composer cache directory
250-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
244+
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
251245

252246
- name: Cache composer dependencies
253247
uses: actions/cache@v4
@@ -259,8 +253,14 @@ jobs:
259253
- name: Install Composer dependencies
260254
run: composer install --no-progress --prefer-dist --optimize-autoloader
261255

262-
- name: Run unit tests
263-
run: vendor/bin/phpunit --no-coverage
256+
- name: Security check for locked dependencies
257+
run: composer audit
258+
259+
- name: Update Composer dependencies
260+
run: composer update --no-progress --prefer-dist --optimize-autoloader
261+
262+
- name: Security check for updated dependencies
263+
run: composer audit
264264

265265
coverage:
266266
name: Code coverage

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@
3434
}
3535
},
3636
"require": {
37-
"php": "^8.1",
37+
"php": "^8.2",
3838
"ext-libxml": "*",
3939

40-
"simplesamlphp/assert": "~1.8.1",
41-
"simplesamlphp/composer-module-installer": "~1.4.0",
40+
"simplesamlphp/assert": "^1.8",
41+
"simplesamlphp/composer-module-installer": "^1.4",
4242
"simplesamlphp/simplesamlphp": "~2.4.0",
43-
"simplesamlphp/xml-common": "~1.25.0",
43+
"simplesamlphp/xml-common": "~1.25.0 || ~2.0.0",
4444
"symfony/http-foundation": "~6.4.0",
4545
"symfony/var-exporter": "~6.4.0"
4646
},
4747
"require-dev": {
48-
"simplesamlphp/simplesamlphp-test-framework": "~1.9.2"
48+
"simplesamlphp/simplesamlphp-test-framework": "~1.10.3"
4949
},
5050
"support": {
5151
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-metarefresh/issues",

0 commit comments

Comments
 (0)