Skip to content

Commit 6048c8e

Browse files
committed
Replace super-linter with a reusable workflow
1 parent 0ad3170 commit 6048c8e

3 files changed

Lines changed: 53 additions & 29 deletions

File tree

.github/workflows/php.yml

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +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_YAML: true
38-
VALIDATE_XML: true
39-
VALIDATE_GITHUB_ACTIONS: true
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
4039

4140
quality:
4241
name: Quality control
42+
needs: [unit-tests-linux]
4343
runs-on: [ubuntu-latest]
4444

4545
steps:
@@ -49,7 +49,7 @@ jobs:
4949
uses: shivammathur/setup-php@v2
5050
with:
5151
# Should be the higest supported version, so we can use the newest tools
52-
php-version: '8.3'
52+
php-version: '8.4'
5353
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
5454
# optional performance gain for psalm: opcache
5555
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, spl, xml
@@ -108,7 +108,9 @@ jobs:
108108
109109
security:
110110
name: Security checks
111+
needs: [unit-tests-linux]
111112
runs-on: [ubuntu-latest]
113+
112114
steps:
113115
- name: Setup PHP, with composer and extensions
114116
# https://github.com/shivammathur/setup-php
@@ -150,12 +152,12 @@ jobs:
150152
unit-tests-linux:
151153
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
152154
runs-on: ${{ matrix.operating-system }}
153-
needs: [linter, quality, security]
155+
needs: [phplinter, linter]
154156
strategy:
155157
fail-fast: false
156158
matrix:
157159
operating-system: [ubuntu-latest]
158-
php-versions: ['8.1', '8.2', '8.3']
160+
php-versions: ['8.1', '8.2', '8.3', '8.4']
159161

160162
steps:
161163
- name: Setup PHP, with composer and extensions
@@ -195,15 +197,15 @@ jobs:
195197
run: composer install --no-progress --prefer-dist --optimize-autoloader
196198

197199
- name: Run unit tests with coverage
198-
if: ${{ matrix.php-versions == '8.3' }}
200+
if: ${{ matrix.php-versions == '8.4' }}
199201
run: vendor/bin/phpunit
200202

201203
- name: Run unit tests (no coverage)
202-
if: ${{ matrix.php-versions != '8.3' }}
204+
if: ${{ matrix.php-versions != '8.4' }}
203205
run: vendor/bin/phpunit --no-coverage
204206

205207
- name: Save coverage data
206-
if: ${{ matrix.php-versions == '8.3' }}
208+
if: ${{ matrix.php-versions == '8.4' }}
207209
uses: actions/upload-artifact@v4
208210
with:
209211
name: coverage-data
@@ -212,12 +214,13 @@ jobs:
212214
unit-tests-windows:
213215
name: "Unit tests, PHP ${{ matrix.php-versions }}, ${{ matrix.operating-system }}"
214216
runs-on: ${{ matrix.operating-system }}
215-
needs: [linter, quality, security]
217+
needs: [phplinter, linter]
218+
216219
strategy:
217220
fail-fast: true
218221
matrix:
219222
operating-system: [windows-latest]
220-
php-versions: ['8.1', '8.2', '8.3']
223+
php-versions: ['8.1', '8.2', '8.3', '8.4']
221224

222225
steps:
223226
- name: Setup PHP, with composer and extensions

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)