Skip to content

Commit 8a2599d

Browse files
authored
Merge pull request #11 from simplesamlphp/feature/replace-superlinter
Replace super-linter with a reusable workflow
2 parents e100e95 + b375995 commit 8a2599d

8 files changed

Lines changed: 166 additions & 155 deletions

File tree

.github/workflows/php.yml

Lines changed: 130 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,140 @@ on: # yamllint disable-line rule:truthy
1414
workflow_dispatch:
1515

1616
jobs:
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']
23+
24+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_phplinter.yml@v1.9.2
25+
with:
26+
php-version: ${{ matrix.php-version }}
27+
1728
linter:
18-
name: Linter
19-
runs-on: ['ubuntu-latest']
29+
name: 'Linter'
30+
strategy:
31+
fail-fast: false
32+
33+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/reusable_linter.yml@v1.9.2
34+
with:
35+
enable_eslinter: false
36+
enable_jsonlinter: true
37+
enable_stylelinter: true
38+
enable_yamllinter: true
39+
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.1', '8.2', '8.3', '8.4']
2049

2150
steps:
51+
- name: Setup PHP, with composer and extensions
52+
# https://github.com/shivammathur/setup-php
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ matrix.php-versions }}
56+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
57+
tools: composer
58+
ini-values: error_reporting=E_ALL
59+
coverage: pcov
60+
61+
- name: Setup problem matchers for PHP
62+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
63+
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+
2272
- uses: actions/checkout@v4
73+
74+
- name: Get composer cache directory
75+
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
76+
77+
- name: Cache composer dependencies
78+
uses: actions/cache@v4
2379
with:
24-
fetch-depth: 0
25-
26-
- name: Lint Code Base
27-
uses: super-linter/super-linter/slim@v7
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-
FILTER_REGEX_EXCLUDE: .*public/assets/css/ui-theme-1.13.2/jquery-ui.min.css
80+
path: $COMPOSER_CACHE
81+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
82+
restore-keys: ${{ runner.os }}-composer-
83+
84+
- name: Install Composer dependencies
85+
run: composer install --no-progress --prefer-dist --optimize-autoloader
86+
87+
- name: Run unit tests with coverage
88+
if: ${{ matrix.php-versions == '8.4' }}
89+
run: vendor/bin/phpunit
90+
91+
- name: Run unit tests (no coverage)
92+
if: ${{ matrix.php-versions != '8.4' }}
93+
run: vendor/bin/phpunit --no-coverage
94+
95+
- name: Save coverage data
96+
if: ${{ matrix.php-versions == '8.4' }}
97+
uses: actions/upload-artifact@v4
98+
with:
99+
name: coverage-data
100+
path: ${{ github.workspace }}/build
101+
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]
106+
strategy:
107+
fail-fast: true
108+
matrix:
109+
operating-system: [windows-latest]
110+
php-versions: ['8.1', '8.2', '8.3', '8.4']
111+
112+
steps:
113+
- name: Setup PHP, with composer and extensions
114+
# https://github.com/shivammathur/setup-php
115+
uses: shivammathur/setup-php@v2
116+
with:
117+
php-version: ${{ matrix.php-versions }}
118+
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
119+
tools: composer
120+
ini-values: error_reporting=E_ALL
121+
coverage: none
122+
123+
- name: Setup problem matchers for PHP
124+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
125+
126+
- name: Setup problem matchers for PHPUnit
127+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
128+
129+
- name: Set git to use LF
130+
run: |
131+
git config --global core.autocrlf false
132+
git config --global core.eol lf
133+
134+
- uses: actions/checkout@v4
135+
136+
- name: Get composer cache directory
137+
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
138+
139+
- name: Cache composer dependencies
140+
uses: actions/cache@v4
141+
with:
142+
path: $COMPOSER_CACHE
143+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
144+
restore-keys: ${{ runner.os }}-composer-
145+
146+
- name: Install Composer dependencies
147+
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req=ext-posix
148+
149+
- name: Run unit tests
150+
run: vendor/bin/phpunit --no-coverage
42151

43152
quality:
44153
name: Quality control
@@ -51,7 +160,7 @@ jobs:
51160
uses: shivammathur/setup-php@v2
52161
with:
53162
# Should be the higest supported version, so we can use the newest tools
54-
php-version: '8.3'
163+
php-version: '8.4'
55164
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
56165
# optional performance gain for psalm: opcache
57166
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, spl, xml
@@ -149,118 +258,6 @@ jobs:
149258
- name: Security check for updated dependencies
150259
run: composer audit
151260

152-
unit-tests-linux:
153-
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
154-
runs-on: ${{ matrix.operating-system }}
155-
needs: [linter, quality, security]
156-
strategy:
157-
fail-fast: false
158-
matrix:
159-
operating-system: [ubuntu-latest]
160-
php-versions: ['8.1', '8.2', '8.3']
161-
162-
steps:
163-
- name: Setup PHP, with composer and extensions
164-
# https://github.com/shivammathur/setup-php
165-
uses: shivammathur/setup-php@v2
166-
with:
167-
php-version: ${{ matrix.php-versions }}
168-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
169-
tools: composer
170-
ini-values: error_reporting=E_ALL
171-
coverage: pcov
172-
173-
- name: Setup problem matchers for PHP
174-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
175-
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-
184-
- uses: actions/checkout@v4
185-
186-
- name: Get composer cache directory
187-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$GITHUB_ENV"
188-
189-
- name: Cache composer dependencies
190-
uses: actions/cache@v4
191-
with:
192-
path: $COMPOSER_CACHE
193-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
194-
restore-keys: ${{ runner.os }}-composer-
195-
196-
- name: Install Composer dependencies
197-
run: composer install --no-progress --prefer-dist --optimize-autoloader
198-
199-
- name: Run unit tests with coverage
200-
if: ${{ matrix.php-versions == '8.3' }}
201-
run: vendor/bin/phpunit
202-
203-
- name: Run unit tests (no coverage)
204-
if: ${{ matrix.php-versions != '8.3' }}
205-
run: vendor/bin/phpunit --no-coverage
206-
207-
- name: Save coverage data
208-
if: ${{ matrix.php-versions == '8.3' }}
209-
uses: actions/upload-artifact@v4
210-
with:
211-
name: coverage-data
212-
path: ${{ github.workspace }}/build
213-
214-
unit-tests-windows:
215-
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
216-
runs-on: ${{ matrix.operating-system }}
217-
needs: [linter, quality, security]
218-
strategy:
219-
fail-fast: true
220-
matrix:
221-
operating-system: [windows-latest]
222-
php-versions: ['8.1', '8.2', '8.3']
223-
224-
steps:
225-
- name: Setup PHP, with composer and extensions
226-
# https://github.com/shivammathur/setup-php
227-
uses: shivammathur/setup-php@v2
228-
with:
229-
php-version: ${{ matrix.php-versions }}
230-
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, openssl, pcre, posix, spl, xml
231-
tools: composer
232-
ini-values: error_reporting=E_ALL
233-
coverage: none
234-
235-
- name: Setup problem matchers for PHP
236-
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
237-
238-
- name: Setup problem matchers for PHPUnit
239-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
240-
241-
- name: Set git to use LF
242-
run: |
243-
git config --global core.autocrlf false
244-
git config --global core.eol lf
245-
246-
- uses: actions/checkout@v4
247-
248-
- name: Get composer cache directory
249-
run: echo COMPOSER_CACHE="$(composer config cache-files-dir)" >> "$env:GITHUB_ENV"
250-
251-
- name: Cache composer dependencies
252-
uses: actions/cache@v4
253-
with:
254-
path: $COMPOSER_CACHE
255-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
256-
restore-keys: ${{ runner.os }}-composer-
257-
258-
- name: Install Composer dependencies
259-
run: composer install --no-progress --prefer-dist --optimize-autoloader --ignore-platform-req=ext-posix
260-
261-
- name: Run unit tests
262-
run: vendor/bin/phpunit --no-coverage
263-
264261
coverage:
265262
name: Code coverage
266263
runs-on: [ubuntu-latest]

codecov.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
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
1113
require_changes: true
12-
require_base: no
13-
require_head: yes
14+
require_base: false
15+
require_head: true
1416
branches: null
1517

1618
github_checks:

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
"require": {
2323
"php": "^8.1",
2424

25-
"simplesamlphp/saml2": "^4.6",
26-
"simplesamlphp/simplesamlphp": "^2.1",
25+
"simplesamlphp/saml2-legacy": "^4.17",
26+
"simplesamlphp/simplesamlphp": "^2.4",
2727
"symfony/http-foundation": "^6.4"
2828
},
2929
"require-dev": {
30-
"simplesamlphp/simplesamlphp-test-framework": "^1.5"
30+
"simplesamlphp/simplesamlphp-test-framework": "^1.9"
3131
},
3232
"config": {
3333
"allow-plugins": {

psalm-dev.xml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,4 @@
1515
<directory name="vendor" />
1616
</ignoreFiles>
1717
</projectFiles>
18-
19-
<issueHandlers>
20-
<!-- Ignore UnresolvableInclude on CLI-scripts -->
21-
<UnresolvableInclude>
22-
<errorLevel type="suppress">
23-
<file name="tests/bootstrap.php" />
24-
</errorLevel>
25-
</UnresolvableInclude>
26-
</issueHandlers>
2718
</psalm>

routing/routes/routes.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
---
2+
13
metaedit-main:
2-
path: /
3-
defaults: { _controller: 'SimpleSAML\Module\metaedit\Controller\MetaEditor::main' }
4+
path: /
5+
defaults: {
6+
_controller: 'SimpleSAML\Module\metaedit\Controller\MetaEditor::main'
7+
}
8+
49
metaedit-edit:
5-
path: /edit
6-
defaults: { _controller: 'SimpleSAML\Module\metaedit\Controller\MetaEditor::edit' }
10+
path: /edit
11+
defaults: {
12+
_controller: 'SimpleSAML\Module\metaedit\Controller\MetaEditor::edit'
13+
}
14+
715
metaedit-import:
8-
path: /import
9-
defaults: { _controller: 'SimpleSAML\Module\metaedit\Controller\MetaEditor::import' }
16+
path: /import
17+
defaults: {
18+
_controller: 'SimpleSAML\Module\metaedit\Controller\MetaEditor::import'
19+
}

tests/src/Controller/MetaEditorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*
1919
* @covers \SimpleSAML\Module\metaedit\Controller\MetaEditor
2020
*/
21-
class MetaEditorTest extends TestCase
21+
final class MetaEditorTest extends TestCase
2222
{
2323
/** @var \SimpleSAML\Configuration */
2424
protected Configuration $config;

tools/linters/.stylelintrc.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"rules": {
3+
}
4+
}

tools/linters/.yaml-lint.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
3+
extends: default
4+
5+
rules:
6+
line-length:
7+
max: 120

0 commit comments

Comments
 (0)