-
Notifications
You must be signed in to change notification settings - Fork 8
177 lines (141 loc) · 5.67 KB
/
test.yml
File metadata and controls
177 lines (141 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: Test
on:
workflow_call:
inputs:
skip_coverage_annotation:
description: 'Skip coverage annotation (required for scheduled runs that lack checks: write permission)'
required: false
default: false
type: boolean
jobs:
tests:
name: Tests (PHP ${{ matrix.php }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
php: ['8.2', '8.3', '8.4', '8.5']
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: ${{ matrix.php }}
extensions: json
coverage: xdebug
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update -n --prefer-dist
- name: Create build directory
run: mkdir -p build/logs
- name: Run tests
run: vendor/bin/phpunit --testdox --display-all-issues --coverage-clover build/logs/clover.xml
- name: Check coverage threshold
run: php scripts/check-coverage-threshold.php build/logs/clover.xml
- name: Code Coverage Annotation
if: ${{ !inputs.skip_coverage_annotation }}
uses: ggilder/codecoverage@ae4850f3af863bd0a54e9934478998385ffad725 # v1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERAGE_FILE_PATH: build/logs/clover.xml
COVERAGE_FORMAT: clover
- name: Upload test results
if: always()
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: test-results-php-${{ matrix.php }}
path: build/logs/
retention-days: 7
code-style:
name: Code Style
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: '8.2'
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update -n --prefer-dist
- name: Run PHP CS Fixer
run: vendor/bin/php-cs-fixer fix -v --dry-run --using-cache=no
static-analysis:
name: Static Analysis
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: '8.2'
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update -n --prefer-dist
- name: Run PHPStan
run: vendor/bin/phpstan analyse
mutation-testing:
name: Mutation Testing
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6
- name: Setup PHP
uses: shivammathur/setup-php@44454db4f0199b8b9685a5d763dc37cbf79108e1 # v2
with:
php-version: '8.2'
extensions: json
coverage: xdebug
tools: composer:v2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- name: Cache dependencies
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer update -n --prefer-dist
- name: Download Infection PHAR
run: |
wget https://github.com/infection/infection/releases/download/0.32.3/infection.phar
wget https://github.com/infection/infection/releases/download/0.32.3/infection.phar.asc
- name: Validate Infection PHAR
run: |
gpg --keyserver hkps://keys.openpgp.org --recv-keys C6D76C329EBADE2FB9C458CFC5095986493B4AA0
gpg --with-fingerprint --verify infection.phar.asc infection.phar
chmod +x infection.phar
- name: Run mutation testing
run: ./infection.phar --threads=max --min-msi=100 --min-covered-msi=100