Skip to content

Commit 3f69a19

Browse files
authored
Merge pull request #11 from simplesamlphp/feature/replace-superlinter
Replace super-linter with a reusable workflow
2 parents 6efa1c4 + c46f3a5 commit 3f69a19

File tree

6 files changed

+81
-50
lines changed

6 files changed

+81
-50
lines changed

.github/workflows/php.yml

Lines changed: 25 additions & 24 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:
@@ -109,7 +108,9 @@ jobs:
109108
110109
security:
111110
name: Security checks
111+
needs: [unit-tests-linux]
112112
runs-on: [ubuntu-latest]
113+
113114
steps:
114115
- name: Setup PHP, with composer and extensions
115116
# https://github.com/shivammathur/setup-php
@@ -151,7 +152,7 @@ jobs:
151152
unit-tests-linux:
152153
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
153154
runs-on: ${{ matrix.operating-system }}
154-
needs: [linter, quality, security]
155+
needs: [phplinter, linter]
155156
strategy:
156157
fail-fast: false
157158
matrix:
@@ -216,7 +217,7 @@ jobs:
216217
unit-tests-windows:
217218
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
218219
runs-on: ${{ matrix.operating-system }}
219-
needs: [linter, quality, security]
220+
needs: [phplinter, linter]
220221
strategy:
221222
fail-fast: true
222223
matrix:

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: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,43 @@
1+
---
2+
13
negotiate-auth:
2-
path: /auth
3-
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::auth' }
4-
methods: [GET]
4+
path: /auth
5+
defaults: {
6+
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::auth'
7+
}
8+
methods: [GET]
59

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

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

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

2131
negotiate-retry:
22-
path: /retry
23-
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::retry' }
24-
methods: [GET]
32+
path: /retry
33+
defaults: {
34+
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::retry'
35+
}
36+
methods: [GET]
2537

2638
negotiate-fallback:
27-
path: /fallback
28-
defaults: { _controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::fallback' }
29-
methods: [GET]
39+
path: /fallback
40+
defaults: {
41+
_controller: 'SimpleSAML\Module\negotiateext\Controller\NegotiateController::fallback'
42+
}
43+
methods: [GET]

tests/src/Controller/NegotiateControllerTest.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,9 @@
1818
*
1919
* @package SimpleSAML\Test
2020
*/
21-
class NegotiateControllerTest extends TestCase
21+
final class NegotiateControllerTest extends TestCase
2222
{
23-
/** @var \SimpleSAML\Configuration */
2423
protected Configuration $config;
25-
26-
/** @var \SimpleSAML\Session */
2724
protected Session $session;
2825

2926
/**
@@ -125,8 +122,6 @@ public function testErrorInvalidState(): void
125122
public function testEnable(): void
126123
{
127124
$c = new Controller\NegotiateController($this->config, $this->session);
128-
129-
/** @var \SimpleSAML\XHTML\Template $response */
130125
$response = $c->enable();
131126

132127
// Validate response
@@ -157,8 +152,6 @@ public function testEnable(): void
157152
public function testDisable(): void
158153
{
159154
$c = new Controller\NegotiateController($this->config, $this->session);
160-
161-
/** @var \SimpleSAML\XHTML\Template $response */
162155
$response = $c->disable();
163156

164157
// Validate response

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)