Skip to content

Commit 41ee53e

Browse files
Add minimum coverage threshold
1 parent 9874b03 commit 41ee53e

File tree

4 files changed

+18
-9
lines changed

4 files changed

+18
-9
lines changed

.github/workflows/main.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [ "ubuntu-latest", "windows-latest" ]
19-
php-version: [ "7.4", "8.0", "8.1", "8.2" ]
19+
php-version: [ "7.4", "8.0", "8.1" ]
2020

2121
env:
2222
COMPOSER_VERSION: 2
23+
MINIMUM_COVERAGE_PERCENTAGE: 80
24+
MINIMUM_MSI_PERCENTAGE: 80
2325

2426
steps:
2527
- name: Checkout repository
@@ -55,5 +57,8 @@ jobs:
5557
- name: Run unit tests
5658
run: XDEBUG_MODE=coverage php vendor/bin/phpunit --testsuite unit
5759

60+
- name: Checkout coverage report
61+
run: php vendor/bin/coverage-check coverage/clover.xml ${{ env.MINIMUM_COVERAGE_PERCENTAGE }}
62+
5863
- name: Run mutation tests
59-
run: XDEBUG_MODE=coverage php vendor/bin/infection --show-mutations
64+
run: XDEBUG_MODE=coverage php vendor/bin/infection --show-mutations --min-msi=${{ env.MINIMUM_MSI_PERCENTAGE }} --threads=4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ vendor/
55
*.idea
66
.phpunit.result.cache
77
.php-cs-fixer.cache
8+
coverage/

composer.json

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
"require-dev": {
5454
"phpunit/phpunit": "~9.0",
5555
"infection/infection": "^0.25.5",
56-
"friendsofphp/php-cs-fixer": "^3.0"
56+
"friendsofphp/php-cs-fixer": "^3.0",
57+
"rregeer/phpunit-coverage-check": "^0.3.1"
5758
},
5859
"autoload": {
5960
"psr-4": {
@@ -65,12 +66,6 @@
6566
"WikibaseSolutions\\CypherDSL\\Tests\\": "tests/"
6667
}
6768
},
68-
"scripts": {
69-
"test": "phpunit tests/",
70-
"infect": "XDEBUG_MODE=coverage infection --show-mutations",
71-
"php-cs-fixer":
72-
"php-cs-fixer fix --verbose --rules=@PSR12,align_multiline_comment,array_indentation,blank_line_before_statement,no_unused_imports,no_useless_else,no_useless_return,ordered_imports,phpdoc_scalar,return_assignment,simplified_if_return,trailing_comma_in_multiline"
73-
},
7469
"config": {
7570
"allow-plugins": {
7671
"infection/extension-installer": true

phpunit.xml.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,12 @@
99
<directory>tests/Unit</directory>
1010
</testsuite>
1111
</testsuites>
12+
<coverage processUncoveredFiles="true" cacheDirectory="coverage/cache" pathCoverage="true">
13+
<report>
14+
<clover outputFile="coverage/clover.xml" />
15+
</report>
16+
<include>
17+
<directory suffix=".php">src</directory>
18+
</include>
19+
</coverage>
1220
</phpunit>

0 commit comments

Comments
 (0)