mirror of
https://gh.wpcy.net/https://github.com/WordPress/WordPress-Coding-Standards.git
synced 2026-04-24 23:58:18 +08:00
Follow up after PR 2225 and other PRs which added more tests and raised code coverage.
The Codecov service is a way to monitor test vs code coverage of a project over time and allows for the code coverage % + delta to be reported in each PR.
This commit:
* Adds CodeCov configuration and ignores it for creating the package file.
* Note: by default CodeCov reports back with build statuses (in the table at the bottom of a PR) + posts a really extensive comment on a PR.
I personally find those comments + mail on each PR terribly annoying and unnecessary when the build statuses are set to required statuses anyway, so I've turned the posting of those comments off (via a setting in the configuration file).
* Another thing to note is the patch - threshold setting being at `3%` (= 3% deviation allowed). The reason for setting that threshold a little wider is that code removals for fully covered code would otherwise quickly fail builds.
* Adds a badge showing off code coverage to the README.
* Adjusts the GH Actions workflows.
* For the `test` workflow (PRs), the tests will selectively be run with code coverage (high/low PHP x high/low PHPCS).
* For the `quicktest` workflow (pushes), which only runs high/low PHP/PHPCS, the code coverage will only be run for (merges to) the `develop` branch.
This will allow us keep track of code coverage over time, while not slowing down the "quick test" for feature branch pushes.
Note: I've simplified the conditions a little for this workflow as we only run against two known PHP versions anyway.
* Makes a minor tweak to the code coverage logging config to only display a summary after a code coverage run.
Note: As this is a public repo, we shouldn't need a repo secret for the CodeCov token. The normal GHA token will be used (and should work fine).
Refs:
* https://docs.codecov.com/docs
* https://docs.codecov.com/docs/codecovyml-reference
Note: as this PR can only partially be tested without it being merged, minor touch-up may be needed after this initial setup, but :fingers_crossed: we should be good.
34 lines
1.1 KiB
XML
34 lines
1.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<phpunit
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/6.3/phpunit.xsd"
|
|
backupGlobals="true"
|
|
bootstrap="./Tests/bootstrap.php"
|
|
beStrictAboutTestsThatDoNotTestAnything="false"
|
|
colors="true"
|
|
forceCoversAnnotation="true">
|
|
|
|
<testsuites>
|
|
<testsuite name="WordPress">
|
|
<directory suffix="UnitTest.php">./WordPress/Tests/</directory>
|
|
</testsuite>
|
|
</testsuites>
|
|
|
|
<filter>
|
|
<whitelist addUncoveredFilesFromWhitelist="true" processUncoveredFilesFromWhitelist="false">
|
|
<file>./WordPress/Sniff.php</file>
|
|
<file>./WordPress/AbstractArrayAssignmentRestrictionsSniff.php</file>
|
|
<file>./WordPress/AbstractClassRestrictionsSniff.php</file>
|
|
<file>./WordPress/AbstractFunctionParameterSniff.php</file>
|
|
<file>./WordPress/AbstractFunctionRestrictionsSniff.php</file>
|
|
<directory>./WordPress/Sniffs/</directory>
|
|
<directory>./WordPress/Helpers/</directory>
|
|
</whitelist>
|
|
</filter>
|
|
|
|
<logging>
|
|
<log type="coverage-text" target="php://stdout" showOnlySummary="true"/>
|
|
<log type="coverage-clover" target="build/logs/clover.xml"/>
|
|
</logging>
|
|
|
|
</phpunit>
|