Skip to content

Commit

Permalink
coverage: Always process coverage, even if tests fail (#40167)
Browse files Browse the repository at this point in the history
First, for projects that have both JS and PHP tests or multiple suites
of tests, run all the tests for coverage even if one fails. Mostly this
means using the `concurrently` package, since that's a very easy way to
run both and collect the exit statuses.

Then, in the workflow itself, add `always()` to the `if` on the step for
processing coverage reports so it runs even if the tests failed to
process whatever data is available.

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/11842463094

Upstream-Ref: Automattic/jetpack@bbb0564
  • Loading branch information
anomiex authored and matticbot committed Nov 14, 2024
1 parent 09bd5fa commit 37f168f
Show file tree
Hide file tree
Showing 9 changed files with 145 additions and 161 deletions.
5 changes: 1 addition & 4 deletions jetpack_vendor/automattic/jetpack-assets/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
"phpunit": [
"./vendor/phpunit/phpunit/phpunit --colors=always"
],
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\"",
"pnpm run test-coverage"
],
"test-coverage": "pnpm concurrently --names php,js 'php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\"' 'pnpm:test-coverage'",
"test-js": [
"pnpm run test"
],
Expand Down
5 changes: 1 addition & 4 deletions jetpack_vendor/automattic/jetpack-explat/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
"phpunit": [
"./vendor/phpunit/phpunit/phpunit --colors=always"
],
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\"",
"pnpm run test-coverage"
],
"test-coverage": "pnpm concurrently --names php,js 'php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\"' 'pnpm:test-coverage'",
"test-php": [
"@composer phpunit"
],
Expand Down
5 changes: 1 addition & 4 deletions jetpack_vendor/automattic/jetpack-my-jetpack/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
"phpunit": [
"./vendor/phpunit/phpunit/phpunit --colors=always"
],
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\"",
"pnpm run test-coverage"
],
"test-coverage": "pnpm concurrently --names php,js 'php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/php.cov\"' 'pnpm:test-coverage'",
"test-php": [
"@composer phpunit"
],
Expand Down
5 changes: 1 addition & 4 deletions jetpack_vendor/automattic/jetpack-waf/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
],
"post-install-cmd": "WorDBless\\Composer\\InstallDropin::copy",
"post-update-cmd": "WorDBless\\Composer\\InstallDropin::copy",
"test-coverage": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/integration/php.cov\" --configuration tests/php/integration/phpunit.xml.dist",
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-php \"$COVERAGE_DIR/unit/php.cov\" --configuration tests/php/unit/phpunit.xml.dist"
],
"test-coverage": "tests/action-test-coverage.sh",
"test-coverage-html": [
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-html ./coverage --configuration tests/php/integration/phpunit.xml.dist",
"php -dpcov.directory=. ./vendor/bin/phpunit --coverage-html ./coverage --configuration tests/php/unit/phpunit.xml.dist"
Expand Down
8 changes: 4 additions & 4 deletions jetpack_vendor/i18n-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
),
'jetpack-assets' => array(
'path' => 'jetpack_vendor/automattic/jetpack-assets',
'ver' => '3.0.0-alpha1731518828',
'ver' => '3.0.0-alpha1731605603',
),
'jetpack-boost-core' => array(
'path' => 'jetpack_vendor/automattic/jetpack-boost-core',
Expand All @@ -30,7 +30,7 @@
),
'jetpack-explat' => array(
'path' => 'jetpack_vendor/automattic/jetpack-explat',
'ver' => '0.2.0-alpha1731518828',
'ver' => '0.2.0-alpha1731605603',
),
'jetpack-ip' => array(
'path' => 'jetpack_vendor/automattic/jetpack-ip',
Expand All @@ -46,7 +46,7 @@
),
'jetpack-my-jetpack' => array(
'path' => 'jetpack_vendor/automattic/jetpack-my-jetpack',
'ver' => '5.0.0-alpha1731518828',
'ver' => '5.0.0-alpha1731605603',
),
'jetpack-password-checker' => array(
'path' => 'jetpack_vendor/automattic/jetpack-password-checker',
Expand Down Expand Up @@ -74,7 +74,7 @@
),
'jetpack-waf' => array(
'path' => 'jetpack_vendor/automattic/jetpack-waf',
'ver' => '0.23.0-alpha1731518828',
'ver' => '0.23.0-alpha1731605603',
),
),
);
Loading

0 comments on commit 37f168f

Please sign in to comment.