Skip to content

Commit 9f3cd38

Browse files
committed
ci: add mutation testing support and CI/CD workflow
1 parent 0a40196 commit 9f3cd38

File tree

6 files changed

+949
-8
lines changed

6 files changed

+949
-8
lines changed

.github/workflows/coding-standards.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ on: # yamllint disable-line rule:truthy
44
pull_request:
55
branches:
66
- master
7-
push:
8-
branches:
9-
- master
107

118
name: 🧹 Fix PHP coding standards
129

@@ -26,7 +23,7 @@ jobs:
2623
with:
2724
configFile: ${{ github.workspace }}/.github/.commitlint.config.mjs
2825
failOnWarnings: false
29-
failOnErrors: false
26+
failOnErrors: true
3027
helpURL: 'https://github.com/conventional-changelog/commitlint/#what-is-commitlint'
3128

3229
yaml-linting:

.github/workflows/security.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22

3-
name: 🔐 Security analysis
4-
53
on: # yamllint disable-line rule:truthy
64
pull_request:
7-
push:
5+
branches:
6+
- master
7+
8+
name: 🔐 Security analysis
89

910
jobs:
1011
security-analysis:

.github/workflows/testing.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,60 @@ jobs:
135135
- name: 🧪 Run tests that require separate process using phpunit/phpunit
136136
run: composer test:sep
137137

138+
139+
mutation-testing:
140+
timeout-minutes: 16
141+
runs-on: ${{ matrix.os }}
142+
concurrency:
143+
cancel-in-progress: true
144+
group: mutation-testing-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
145+
strategy:
146+
fail-fast: true
147+
matrix:
148+
os:
149+
- ubuntu-latest
150+
php-version:
151+
- '8.2'
152+
dependencies:
153+
- locked
154+
steps:
155+
- name: 📦 Check out the codebase
156+
uses: actions/checkout@v4.1.6
157+
158+
- name: 🛠️ Setup PHP
159+
uses: shivammathur/setup-php@2.30.4
160+
with:
161+
php-version: ${{ matrix.php-version }}
162+
extensions: mbstring, pdo, pdo_sqlite
163+
ini-values: error_reporting=E_ALL
164+
coverage: xdebug
165+
166+
- name: 🛠️ Setup problem matchers
167+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
168+
169+
- name: 🤖 Validate composer.json and composer.lock
170+
run: composer validate --ansi --strict
171+
172+
- name: 🔍 Get composer cache directory
173+
uses: wayofdev/gh-actions/actions/composer/get-cache-directory@v3.1.0
174+
175+
- name: ♻️ Restore cached dependencies installed with composer
176+
uses: actions/cache@v4.0.2
177+
with:
178+
path: ${{ env.COMPOSER_CACHE_DIR }}
179+
key: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}
180+
restore-keys: php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-
181+
182+
- name: 📥 Install "${{ matrix.dependencies }}" dependencies with composer
183+
uses: wayofdev/gh-actions/actions/composer/install@v3.1.0
184+
with:
185+
dependencies: ${{ matrix.dependencies }}
186+
187+
- name: 🧪 Run mutation testing using Xdebug and infection/infection
188+
run: composer infect:ci
189+
env:
190+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
191+
138192
compile-phar:
139193
timeout-minutes: 4
140194
runs-on: ${{ matrix.os }}

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
"phpstan/phpstan-phpunit": "^1.3",
6868
"phpstan/phpstan-strict-rules": "^1.5",
6969
"phpunit/phpunit": "^10.5",
70+
"roave/infection-static-analysis-plugin": "^1.35",
7071
"roxblnfk/unpoly": "^1.8.1",
7172
"vimeo/psalm": "^5.11",
7273
"wayofdev/cs-fixer-config": "^1.4"
@@ -96,6 +97,7 @@
9697
"config": {
9798
"allow-plugins": {
9899
"ergebnis/composer-normalize": true,
100+
"infection/extension-installer": true,
99101
"pestphp/pest-plugin": true,
100102
"phpstan/extension-installer": true
101103
},

0 commit comments

Comments
 (0)