Skip to content

Commit 097e1b3

Browse files
authored
Merge pull request #373 from mglaman/coverage
Update PHPUnit config and workflow
2 parents 6f96a72 + 5a7ec90 commit 097e1b3

File tree

2 files changed

+49
-26
lines changed

2 files changed

+49
-26
lines changed

.github/workflows/php.yml

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,31 @@ on:
88
- cron: 0 0 * * *
99

1010
jobs:
11+
lint:
12+
runs-on: "ubuntu-latest"
13+
name: "Linting | PHP ${{ matrix.php-version }}"
14+
strategy:
15+
matrix:
16+
php-version:
17+
- "7.4"
18+
- "8.0"
19+
- "8.1"
20+
steps:
21+
- name: "Checkout"
22+
uses: "actions/checkout@v2"
23+
- name: "Install PHP"
24+
uses: "shivammathur/setup-php@v2"
25+
with:
26+
coverage: "none"
27+
php-version: "${{ matrix.php-version }}"
28+
tools: composer:v2
29+
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, gd
30+
- name: "Install dependencies"
31+
run: "composer update --no-progress --prefer-dist"
32+
- name: "PHPCS"
33+
run: "php vendor/bin/phpcs src"
34+
- name: "PHPStan"
35+
run: "php vendor/bin/phpstan analyze"
1136
tests:
1237
continue-on-error: ${{ matrix.experimental }}
1338
runs-on: "ubuntu-latest"
@@ -33,7 +58,7 @@ jobs:
3358
- name: "Install PHP"
3459
uses: "shivammathur/setup-php@v2"
3560
with:
36-
coverage: "none"
61+
coverage: "xdebug"
3762
php-version: "${{ matrix.php-version }}"
3863
tools: composer:v2
3964
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, gd
@@ -48,14 +73,13 @@ jobs:
4873
if: ${{ matrix.drupal != '^8.9' }}
4974
- name: "Install dependencies"
5075
run: "composer update --no-progress --prefer-dist"
51-
- name: "PHPCS"
52-
run: "php vendor/bin/phpcs src"
53-
- name: "PHPStan"
54-
run: "php vendor/bin/phpstan analyze"
5576
- name: "PHPUnit"
5677
run: "php vendor/bin/phpunit --debug"
5778

5879
build_integration:
80+
needs:
81+
- lint
82+
- tests
5983
continue-on-error: ${{ matrix.experimental }}
6084
runs-on: "ubuntu-latest"
6185
name: "Build Integration | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"
@@ -133,6 +157,9 @@ jobs:
133157
./vendor/bin/phpstan analyze web/modules/contrib --no-progress || if (($? == 255)); then false; else true; fi
134158
COMPOSER_MEMORY_LIMIT=-1 composer remove drupal/video_embed_field drupal/slick
135159
build_integration_no_phpunit:
160+
needs:
161+
- lint
162+
- tests
136163
continue-on-error: ${{ matrix.experimental }}
137164
runs-on: "ubuntu-latest"
138165
name: "Build Integration (No PHPUnit) | PHP ${{ matrix.php-version }} | Drupal ${{ matrix.drupal }}"

phpunit.xml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
4-
bootstrap="vendor/autoload.php"
5-
forceCoversAnnotation="false"
6-
beStrictAboutCoversAnnotation="true"
7-
beStrictAboutOutputDuringTests="true"
8-
beStrictAboutTodoAnnotatedTests="true"
9-
beStrictAboutChangesToGlobalState="true"
10-
verbose="false">
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php"
4+
forceCoversAnnotation="false" beStrictAboutCoversAnnotation="true" beStrictAboutOutputDuringTests="true"
5+
beStrictAboutTodoAnnotatedTests="true" beStrictAboutChangesToGlobalState="true" verbose="false">
6+
<coverage processUncoveredFiles="true">
7+
<include>
8+
<directory suffix=".php">src</directory>
9+
</include>
10+
<exclude>
11+
<directory>./vendor</directory>
12+
<directory>./tests</directory>
13+
</exclude>
14+
<report>
15+
<clover outputFile="clover.xml"/>
16+
<text outputFile="php://stdout" showUncoveredFiles="true"/>
17+
</report>
18+
</coverage>
1119
<php>
1220
<ini name="error_reporting" value="32767"/>
1321
<ini name="memory_limit" value="-1"/>
@@ -19,17 +27,5 @@
1927
<directory suffix="Test.php">tests/src</directory>
2028
</testsuite>
2129
</testsuites>
22-
<logging>
23-
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true" lowUpperBound="50" highLowerBound="80" />
24-
<log type="coverage-clover" target="./clover.xml" />
25-
</logging>
26-
<filter>
27-
<whitelist processUncoveredFilesFromWhitelist="true">
28-
<directory suffix=".php">src</directory>
29-
<exclude>
30-
<directory>./vendor</directory>
31-
<directory>./tests</directory>
32-
</exclude>
33-
</whitelist>
34-
</filter>
30+
<logging/>
3531
</phpunit>

0 commit comments

Comments
 (0)