Skip to content

Commit 7e01600

Browse files
committed
Bump minimum PHP version, replace super-linter
1 parent 23b278d commit 7e01600

2 files changed

Lines changed: 136 additions & 135 deletions

File tree

.github/workflows/php.yml

Lines changed: 130 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -14,143 +14,46 @@ 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-
# super-linter needs the full git history to get the
25-
# list of files that changed across commits
26-
fetch-depth: 0
27-
28-
- name: Lint Code Base
29-
uses: super-linter/super-linter/slim@v8
30-
env:
31-
SAVE_SUPER_LINTER_OUTPUT: false
32-
# To report GitHub Actions status checks
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
LINTER_RULES_PATH: 'tools/linters'
35-
LOG_LEVEL: NOTICE
36-
VALIDATE_ALL_CODEBASE: true
37-
VALIDATE_JSON: true
38-
VALIDATE_PHP_BUILTIN: true
39-
VALIDATE_YAML: true
40-
VALIDATE_XML: true
41-
VALIDATE_GITHUB_ACTIONS: true
42-
43-
quality:
44-
name: Quality control
45-
runs-on: [ubuntu-latest]
46-
47-
steps:
48-
- name: Setup PHP, with composer and extensions
49-
id: setup-php
50-
# https://github.com/shivammathur/setup-php
51-
uses: shivammathur/setup-php@v2
52-
with:
53-
# Should be the higest supported version, so we can use the newest tools
54-
php-version: '8.3'
55-
tools: composer, composer-require-checker, composer-unused, phpcs
56-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, 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: PHPStan
89-
run: |
90-
vendor/bin/phpstan analyze -c phpstan.neon --debug
91-
92-
- name: PHPStan (testsuite)
93-
run: |
94-
vendor/bin/phpstan analyze -c phpstan-dev.neon --debug
95-
96-
security:
97-
name: Security checks
98-
runs-on: [ubuntu-latest]
99-
steps:
100-
- name: Setup PHP, with composer and extensions
101-
# https://github.com/shivammathur/setup-php
102-
uses: shivammathur/setup-php@v2
103-
with:
104-
# Should be the lowest supported version
105-
php-version: '8.1'
106-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
107-
tools: composer
108-
coverage: none
109-
110-
- name: Setup problem matchers for PHP
111-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
112-
113-
- uses: actions/checkout@v6
114-
115-
- name: Get composer cache directory
116-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
117-
118-
- name: Cache composer dependencies
119-
uses: actions/cache@v5
120-
with:
121-
path: $COMPOSER_CACHE
122-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
123-
restore-keys: ${{ runner.os }}-composer-
17+
phplinter:
18+
name: 'PHP-Linter'
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
php-version: ['8.3', '8.4', '8.5']
12423

125-
- name: Install Composer dependencies
126-
run: composer install --no-progress --prefer-dist --optimize-autoloader
24+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.11.0
25+
with:
26+
php-version: ${{ matrix.php-version }}
12727

128-
- name: Security check for locked dependencies
129-
run: composer audit
28+
linter:
29+
name: 'Linter'
30+
strategy:
31+
fail-fast: false
13032

131-
- name: Update Composer dependencies
132-
run: composer update --no-progress --prefer-dist --optimize-autoloader
133-
134-
- name: Security check for updated dependencies
135-
run: composer audit
33+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.11.0
34+
with:
35+
enable_eslinter: false
36+
enable_jsonlinter: true
37+
enable_stylelinter: false
38+
enable_yamllinter: true
13639

13740
unit-tests-linux:
13841
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
13942
runs-on: ${{ matrix.operating-system }}
140-
needs: [linter, quality, security]
43+
needs: [phplinter, linter]
14144
strategy:
14245
fail-fast: false
14346
matrix:
14447
operating-system: [ubuntu-latest]
145-
php-versions: ['8.1', '8.2', '8.3']
48+
php-versions: ['8.2', '8.3', '8.4', '8.5']
14649

14750
steps:
14851
- name: Setup PHP, with composer and extensions
14952
# https://github.com/shivammathur/setup-php
15053
uses: shivammathur/setup-php@v2
15154
with:
15255
php-version: ${{ matrix.php-versions }}
153-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
56+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, sodium, spl, xml
15457
tools: composer
15558
ini-values: error_reporting=E_ALL
15659
coverage: pcov
@@ -172,25 +75,25 @@ jobs:
17275
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
17376

17477
- name: Cache composer dependencies
175-
uses: actions/cache@v5
78+
uses: actions/cache@v6
17679
with:
177-
path: $COMPOSER_CACHE
80+
path: ${{ env.COMPOSER_CACHE }}
17881
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
17982
restore-keys: ${{ runner.os }}-composer-
18083

18184
- name: Install Composer dependencies
18285
run: composer install --no-progress --prefer-dist --optimize-autoloader
18386

18487
- name: Run unit tests with coverage
185-
if: ${{ matrix.php-versions == '8.3' }}
88+
if: ${{ matrix.php-versions == '8.5' }}
18689
run: vendor/bin/phpunit
18790

18891
- name: Run unit tests (no coverage)
189-
if: ${{ matrix.php-versions != '8.3' }}
92+
if: ${{ matrix.php-versions != '8.5' }}
19093
run: vendor/bin/phpunit --no-coverage
19194

19295
- name: Save coverage data
193-
if: ${{ matrix.php-versions == '8.3' }}
96+
if: ${{ matrix.php-versions == '8.5' }}
19497
uses: actions/upload-artifact@v6
19598
with:
19699
name: coverage-data
@@ -199,20 +102,21 @@ jobs:
199102
unit-tests-windows:
200103
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
201104
runs-on: ${{ matrix.operating-system }}
202-
needs: [linter, quality, security]
105+
needs: [phplinter, linter]
203106
strategy:
204107
fail-fast: true
205108
matrix:
206109
operating-system: [windows-latest]
207-
php-versions: ['8.1', '8.2', '8.3']
110+
php-versions: ['8.3', '8.4', '8.5']
208111

209112
steps:
210113
- name: Setup PHP, with composer and extensions
211114
# https://github.com/shivammathur/setup-php
212115
uses: shivammathur/setup-php@v2
213116
with:
214117
php-version: ${{ matrix.php-versions }}
215-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml, zip
118+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre,\
119+
posix, sodium, spl, xml, zip
216120
tools: composer
217121
ini-values: error_reporting=E_ALL
218122
coverage: none
@@ -234,9 +138,9 @@ jobs:
234138
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
235139

236140
- name: Cache composer dependencies
237-
uses: actions/cache@v5
141+
uses: actions/cache@v6
238142
with:
239-
path: $COMPOSER_CACHE
143+
path: ${{ env.COMPOSER_CACHE }}
240144
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
241145
restore-keys: ${{ runner.os }}-composer-
242146

@@ -246,6 +150,103 @@ jobs:
246150
- name: Run unit tests
247151
run: vendor/bin/phpunit --no-coverage
248152

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

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
}
3535
},
3636
"require": {
37-
"php": "^8.1",
37+
"php": "^8.3",
3838

39-
"league/oauth1-client": "^1.10",
40-
"simplesamlphp/assert": "^1.0",
41-
"simplesamlphp/simplesamlphp": "^2.1",
42-
"symfony/http-foundation": "^6.4"
39+
"league/oauth1-client": "^1.11",
40+
"simplesamlphp/assert": "^1.9",
41+
"simplesamlphp/simplesamlphp": "^2.5@dev",
42+
"symfony/http-foundation": "^7.4"
4343
},
4444
"require-dev": {
45-
"simplesamlphp/simplesamlphp-test-framework": "^1.5"
45+
"simplesamlphp/simplesamlphp-test-framework": "^1.11"
4646
},
4747
"support": {
4848
"issues": "https://github.com/simplesamlphp/simplesamlphp-module-authtwitter/issues",

0 commit comments

Comments
 (0)