Skip to content

Commit 558ed2a

Browse files
committed
Replace super-linter with a reusable workflow
1 parent 97a89f0 commit 558ed2a

File tree

4 files changed

+138
-142
lines changed

4 files changed

+138
-142
lines changed

.github/workflows/php.yml

Lines changed: 130 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +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: false
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, sockets, 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
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, sockets, 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
41151

42152
quality:
43153
name: Quality control
@@ -50,7 +160,7 @@ jobs:
50160
uses: shivammathur/setup-php@v2
51161
with:
52162
# Should be the higest supported version, so we can use the newest tools
53-
php-version: '8.3'
163+
php-version: '8.4'
54164
tools: composer, composer-require-checker, composer-unused, phpcs, psalm
55165
# optional performance gain for psalm: opcache
56166
extensions: ctype, date, dom, fileinfo, filter, hash, intl, mbstring, opcache, openssl, pcre, posix, sockets, spl, xml
@@ -148,118 +258,6 @@ jobs:
148258
- name: Security check for updated dependencies
149259
run: composer audit
150260

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

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>

tests/src/Auth/Process/FticksTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use function array_merge;
1616
use function preg_quote;
1717

18-
class FticksTest extends TestCase
18+
final class FticksTest extends TestCase
1919
{
2020
/** @var array minimal request */
2121
private static $minRequest = [

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)