Skip to content

Commit b8ebb13

Browse files
Added tests report to Codecov (#205)
* Added Codecov
1 parent 4d2ed41 commit b8ebb13

File tree

3 files changed

+56
-32
lines changed

3 files changed

+56
-32
lines changed

.github/workflows/php.yml

+18-16
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
BROWSERTEST_OUTPUT_DIRECTORY: "sites/simpletest/browser_output"
1313
BROWSERTEST_OUTPUT_BASE_URL: ""
1414
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", { "chromeOptions": { "w3c": false } }, "http://127.0.0.1:9515/wd/hub"]'
15-
15+
1616
on:
1717
push:
1818
pull_request_target:
@@ -48,7 +48,7 @@ jobs:
4848
- name: "Install PHP"
4949
uses: "shivammathur/setup-php@v2"
5050
with:
51-
coverage: "none"
51+
coverage: "xdebug"
5252
php-version: "${{ matrix.php-version }}"
5353
tools: composer:v2
5454
extensions: dom, curl, libxml, mbstring, zip, pdo, mysql, pdo_mysql, bcmath, gd, exif, iconv, opcache, imagick
@@ -104,36 +104,38 @@ jobs:
104104
name: composer-${{ matrix.php-version }}-${{ matrix.drupal-core }}-artifact
105105
path: drupal/composer.*
106106

107-
- name: "PHPUnit unit"
108-
run: |
109-
cd drupal
110-
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite unit
111-
112-
- name: "PHPUnit kernel"
113-
run: |
114-
cd drupal
115-
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite kernel
116-
117107
- uses: nanasess/setup-chromedriver@v1
118108

119109
- run: |
120110
export DISPLAY=:99
121111
chromedriver --url-base=/wd/hub &
122112
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
123113
124-
- name: "PHPUnit functional javascript"
114+
- name: "Run PHPUnit Tests"
115+
if: ${{ matrix.drupal-core != '9.4.x' || matrix.php-version != '8.1' }}
125116
run: |
126117
cd drupal
127-
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite functional-javascript
118+
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite unit,kernel,functional,functional-javascript modules/contrib/apigee_api_catalog
128119
129-
- name: "PHPUnit functional"
120+
- name: "Run PHPUnit Tests with Code Coverage"
121+
if: ${{ matrix.drupal-core == '9.4.x' && matrix.php-version == '8.1' }}
130122
run: |
131123
cd drupal
132-
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite functional
124+
cp modules/contrib/apigee_api_catalog/phpunit.core.xml.dist core/phpunit.xml
125+
vendor/bin/phpunit -c core --verbose --color --group apigee_api_catalog --testsuite unit,kernel,functional,functional-javascript --coverage-clover /tmp/coverage.xml modules/contrib/apigee_api_catalog
133126
134127
- name: Artifacts
135128
if: failure()
136129
uses: actions/upload-artifact@v3
137130
with:
138131
name: browser-output-${{ matrix.php-version }}-${{ matrix.drupal-core }}-artifact
139132
path: drupal/sites/simpletest/browser_output/*
133+
134+
- name: Upload Coverage to Codecov
135+
if: ${{ matrix.drupal-core == '9.4.x' && matrix.php-version == '8.1' }}
136+
uses: codecov/codecov-action@v3
137+
with:
138+
files: /tmp/coverage.xml
139+
name: codecov-umbrella
140+
fail_ci_if_error: true
141+
verbose: true

codecov.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
codecov:
2+
require_ci_to_pass: yes
3+
4+
coverage:
5+
precision: 2
6+
round: down
7+
range: "70...100"
8+
status:
9+
project: no
10+
patch: no
11+
changes: no
12+
default_rules:
13+
flag_coverage_not_uploaded_behavior: include
14+
15+
github_checks:
16+
annotations: yes
17+
parsers:
18+
gcov:
19+
branch_detection:
20+
conditional: yes
21+
loop: yes
22+
method: no
23+
macro: no
24+
25+
comment:
26+
layout: "reach,diff,flags,tree"
27+
behavior: default
28+
require_changes: no
29+
show_carryforward_flags: no
30+
31+
fixes:
32+
- "drupal/modules/contrib/apigee_api_catalog::/"

phpunit.core.xml.dist

+6-16
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,13 @@
6666
</listeners>
6767
<!-- Filter for coverage reports. -->
6868
<filter>
69-
<whitelist>
70-
<directory>./includes</directory>
71-
<directory>./lib</directory>
72-
<!-- Extensions can have their own test directories, so exclude those. -->
73-
<directory>./modules</directory>
69+
<whitelist processUncoveredFilesFromWhitelist="true">
70+
<directory>../modules/contrib/apigee_api_catalog</directory>
71+
<!-- By definition test classes have no tests. -->
7472
<exclude>
75-
<directory>./modules/*/src/Tests</directory>
76-
<directory>./modules/*/tests</directory>
73+
<directory>../modules/contrib/apigee_api_catalog/tests</directory>
74+
<directory>../modules/contrib/apigee_api_catalog/test_modules</directory>
7775
</exclude>
78-
<directory>../modules</directory>
79-
<exclude>
80-
<directory>../modules/*/src/Tests</directory>
81-
<directory>../modules/*/tests</directory>
82-
<directory>../modules/*/*/src/Tests</directory>
83-
<directory>../modules/*/*/tests</directory>
84-
</exclude>
85-
<directory>../sites</directory>
86-
</whitelist>
76+
</whitelist>
8777
</filter>
8878
</phpunit>

0 commit comments

Comments
 (0)