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 065072b commit 46a898f
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 158 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-search/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,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
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 All @@ -66,7 +66,7 @@
),
'jetpack-search-pkg' => array(
'path' => 'jetpack_vendor/automattic/jetpack-search',
'ver' => '0.47.0-alpha1731518828',
'ver' => '0.47.0-alpha1731605603',
),
'jetpack-stats' => array(
'path' => 'jetpack_vendor/automattic/jetpack-stats',
Expand Down
Loading

0 comments on commit 46a898f

Please sign in to comment.