Skip to content

Commit 5c0ea0d

Browse files
authored
Merge pull request #17 from simplesamlphp/feature/replace-superlinter
Replace super-linter with a reusable workflow
2 parents eff69cc + ef6cb2d commit 5c0ea0d

File tree

6 files changed

+79
-51
lines changed

6 files changed

+79
-51
lines changed

.github/workflows/php.yml

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,32 @@ 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/[email protected]
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
2032

21-
steps:
22-
- uses: actions/checkout@v4
23-
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
33+
uses: simplesamlphp/simplesamlphp-test-framework/.github/workflows/[email protected]
34+
with:
35+
enable_eslinter: true
36+
enable_jsonlinter: true
37+
enable_stylelinter: false
38+
enable_yamllinter: true
4139

4240
quality:
4341
name: Quality control
42+
needs: [unit-tests-linux]
4443
runs-on: [ubuntu-latest]
4544

4645
steps:
@@ -53,7 +52,7 @@ jobs:
5352
uses: shivammathur/setup-php@v2
5453
with:
5554
# Should be the higest supported version, so we can use the newest tools
56-
php-version: '8.3'
55+
php-version: '8.4'
5756
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
5857
# optional performance gain for psalm: opcache
5958
extensions: ctype, date, dom, fileinfo, filter, hash, intl, ldap, mbstring, opcache, openssl, pcre, spl, xml \
@@ -113,7 +112,9 @@ jobs:
113112
114113
security:
115114
name: Security checks
115+
needs: [unit-tests-linux]
116116
runs-on: [ubuntu-latest]
117+
117118
steps:
118119
- name: Setup PHP, with composer and extensions
119120
# https://github.com/shivammathur/setup-php
@@ -155,12 +156,13 @@ jobs:
155156
unit-tests-linux:
156157
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
157158
runs-on: ${{ matrix.operating-system }}
158-
needs: [linter, quality, security]
159+
needs: [phplinter, linter]
160+
159161
strategy:
160162
fail-fast: false
161163
matrix:
162164
operating-system: [ubuntu-latest]
163-
php-versions: ['8.1', '8.2', '8.3']
165+
php-versions: ['8.1', '8.2', '8.3', '8.4']
164166

165167
steps:
166168
- name: Install libkrb5-dev
@@ -204,15 +206,15 @@ jobs:
204206
run: composer install --no-progress --prefer-dist --optimize-autoloader
205207

206208
- name: Run unit tests with coverage
207-
if: ${{ matrix.php-versions == '8.3' }}
209+
if: ${{ matrix.php-versions == '8.4' }}
208210
run: vendor/bin/phpunit
209211

210212
- name: Run unit tests (no coverage)
211-
if: ${{ matrix.php-versions != '8.3' }}
213+
if: ${{ matrix.php-versions != '8.4' }}
212214
run: vendor/bin/phpunit --no-coverage
213215

214216
- name: Save coverage data
215-
if: ${{ matrix.php-versions == '8.3' }}
217+
if: ${{ matrix.php-versions == '8.4' }}
216218
uses: actions/upload-artifact@v4
217219
with:
218220
name: coverage-data
@@ -221,12 +223,12 @@ jobs:
221223
unit-tests-windows:
222224
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
223225
runs-on: ${{ matrix.operating-system }}
224-
needs: [linter, quality, security]
226+
needs: [phplinter, linter]
225227
strategy:
226228
fail-fast: true
227229
matrix:
228230
operating-system: [windows-latest]
229-
php-versions: ['8.1', '8.2', '8.3']
231+
php-versions: ['8.1', '8.2', '8.3', '8.4']
230232

231233
steps:
232234
- name: Setup PHP, with composer and extensions

codecov.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---
2+
13
coverage:
24
status:
35
project:

routing/routes/routes.yaml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
1+
---
2+
13
negotiate-enable:
2-
path: /enable
3-
defaults: { _controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::enable' }
4-
methods: [GET]
4+
path: /enable
5+
defaults: {
6+
_controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::enable'
7+
}
8+
methods: [GET]
59

610
negotiate-disable:
7-
path: /disable
8-
defaults: { _controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::disable' }
9-
methods: [GET]
11+
path: /disable
12+
defaults: {
13+
_controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::disable'
14+
}
15+
methods: [GET]
1016

1117
negotiate-retry:
12-
path: /retry
13-
defaults: { _controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::retry' }
14-
methods: [GET]
18+
path: /retry
19+
defaults: {
20+
_controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::retry'
21+
}
22+
methods: [GET]
1523

1624
negotiate-fallback:
17-
path: /backend
18-
defaults: { _controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::fallback' }
19-
methods: [GET]
25+
path: /backend
26+
defaults: {
27+
_controller: 'SimpleSAML\Module\negotiate\Controller\NegotiateController::fallback'
28+
}
29+
methods: [GET]

tests/src/Controller/NegotiateControllerTest.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,11 @@
2323
* @package SimpleSAML\Test
2424
* @psalm-suppress PropertyNotSetInConstructor
2525
*/
26-
class NegotiateControllerTest extends TestCase
26+
final class NegotiateControllerTest extends TestCase
2727
{
28-
/** @var \SimpleSAML\Configuration */
2928
protected Configuration $config;
30-
31-
/** @var Logger \SimpleSAML\Logger */
32-
protected \SimpleSAML\Logger $logger;
33-
34-
/** @var \SimpleSAML\Module */
29+
protected Logger $logger;
3530
protected Module $module;
36-
37-
/** @var \SimpleSAML\Session */
3831
protected Session $session;
3932

4033

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

tools/linters/eslint.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// eslint.config.js
2+
const { defineConfig } = require("eslint/config");
3+
4+
module.exports = defineConfig([
5+
{
6+
languageOptions: {
7+
ecmaVersion: 2015,
8+
sourceType: "module"
9+
},
10+
files: [
11+
"**.js"
12+
],
13+
}
14+
]);

0 commit comments

Comments
 (0)