Skip to content

Commit 1368b9d

Browse files
committed
Replace super-linter with a reusable workflow
1 parent 0521d7f commit 1368b9d

File tree

2 files changed

+119
-124
lines changed

2 files changed

+119
-124
lines changed

.github/workflows/php.yml

Lines changed: 116 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -14,132 +14,33 @@ 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@v4
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@v7
30-
env:
31-
SAVE_SUPER_LINTER_OUTPUT: false
32-
# To report GitHub Actions status checks
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
FILTER_REGEX_EXCLUDE: .*/resources/xml/domdocument_(invalid_xml|empty).xml
35-
LINTER_RULES_PATH: 'tools/linters'
36-
LOG_LEVEL: NOTICE
37-
VALIDATE_ALL_CODEBASE: true
38-
VALIDATE_GITHUB_ACTIONS: true
39-
VALIDATE_JSON: true
40-
VALIDATE_PHP_BUILTIN: true
41-
VALIDATE_YAML: true
42-
VALIDATE_XML: true
43-
44-
quality:
45-
name: Quality control
46-
runs-on: [ubuntu-latest]
47-
48-
steps:
49-
- name: Setup PHP, with composer and extensions
50-
id: setup-php
51-
# https://github.com/shivammathur/setup-php
52-
uses: shivammathur/setup-php@v2
53-
with:
54-
# Should be the higest supported version, so we can use the newest tools
55-
php-version: '8.4'
56-
tools: composer, composer-require-checker, composer-unused, phpcs
57-
extensions: ctype, date, dom, filter, libxml, pcre, spl, xml
58-
coverage: none
59-
60-
- name: Setup problem matchers for PHP
61-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
62-
63-
- uses: actions/checkout@v4
64-
65-
- name: Get composer cache directory
66-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
67-
68-
- name: Cache composer dependencies
69-
uses: actions/cache@v4
70-
with:
71-
path: $COMPOSER_CACHE
72-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
73-
restore-keys: ${{ runner.os }}-composer-
74-
75-
- name: Validate composer.json and composer.lock
76-
run: composer validate
77-
78-
- name: Install Composer dependencies
79-
run: composer install --no-progress --prefer-dist --optimize-autoloader
80-
81-
- name: Check code for hard dependencies missing in composer.json
82-
run: composer-require-checker check --config-file=tools/composer-require-checker.json composer.json
83-
84-
- name: Check code for unused dependencies in composer.json
85-
run: composer-unused --excludePackage=simplesamlphp/composer-xmlprovider-installer
86-
87-
- name: PHP Code Sniffer
88-
run: phpcs
89-
90-
- name: PHPStan
91-
run: |
92-
vendor/bin/phpstan analyze -c phpstan.neon
93-
94-
- name: PHPStan (testsuite)
95-
run: |
96-
vendor/bin/phpstan analyze -c phpstan-dev.neon
97-
98-
security:
99-
name: Security checks
100-
runs-on: [ubuntu-latest]
101-
steps:
102-
- name: Setup PHP, with composer and extensions
103-
# https://github.com/shivammathur/setup-php
104-
uses: shivammathur/setup-php@v2
105-
with:
106-
# Should be the lowest supported version
107-
php-version: '8.1'
108-
extensions: ctype, date, dom, filter, libxml, pcre, spl, xml
109-
tools: composer
110-
coverage: none
111-
112-
- name: Setup problem matchers for PHP
113-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
114-
115-
- uses: actions/checkout@v4
116-
117-
- name: Get composer cache directory
118-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
119-
120-
- name: Cache composer dependencies
121-
uses: actions/cache@v4
122-
with:
123-
path: $COMPOSER_CACHE
124-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
125-
restore-keys: ${{ runner.os }}-composer-
126-
127-
- name: Install Composer dependencies
128-
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.1', '8.2', '8.3', '8.4']
12923

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

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

136-
- name: Security check for updated dependencies
137-
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
13839

13940
unit-tests-linux:
14041
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
14142
runs-on: ${{ matrix.operating-system }}
142-
needs: [linter, quality, security]
43+
needs: [phplinter, linter]
14344
strategy:
14445
fail-fast: false
14546
matrix:
@@ -201,7 +102,7 @@ jobs:
201102
unit-tests-windows:
202103
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
203104
runs-on: ${{ matrix.operating-system }}
204-
needs: [linter, quality, security]
105+
needs: [phplinter, linter]
205106
strategy:
206107
fail-fast: true
207108
matrix:
@@ -248,6 +149,101 @@ jobs:
248149
- name: Run unit tests
249150
run: vendor/bin/phpunit --no-coverage
250151

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

composer.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@
3434
"ext-pcre": "*",
3535
"ext-spl": "*",
3636

37-
"simplesamlphp/assert": "~1.8.0",
38-
"simplesamlphp/composer-xmlprovider-installer": "~1.0.0",
39-
"symfony/finder": "^6.4"
37+
"simplesamlphp/assert": "~1.8.1",
38+
"symfony/finder": "~6.4.0"
4039
},
4140
"require-dev": {
42-
"simplesamlphp/simplesamlphp-test-framework": "^1.7"
41+
"simplesamlphp/simplesamlphp-test-framework": "~1.9.2"
4342
},
4443
"support": {
4544
"issues": "https://github.com/simplesamlphp/xml-common/issues",

0 commit comments

Comments
 (0)