Skip to content

Commit b53bb0b

Browse files
authored
Merge pull request #2378 from teohhanhui/fix/parallel-phpunit-coverage
Fix test splitting for phpunit-coverage job
2 parents f177cfc + 49744ff commit b53bb0b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.circleci/config.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ jobs:
124124
- image: circleci/php:7.2-node-browsers
125125
environment:
126126
SYMFONY_DEPRECATIONS_HELPER: weak_vendors
127-
APP_ENV: test
128127
parallelism: 2
129128
working_directory: ~/api-platform/core
130129
steps:
@@ -141,8 +140,11 @@ jobs:
141140
- run:
142141
name: Run PHPUnit tests
143142
command: |-
144-
mkdir -p build/logs/tmp build/cov
145-
phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage.cov --log-junit build/logs/tmp/coverage.xml --colors=always
143+
mkdir -p build/logs/parallel build/logs/tmp build/cov
144+
split_tests=$(find tests -name '*Test.php' -not -path 'tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php' | circleci tests split --split-by=timings)
145+
export PARALLEL='-j10% --joblog build/logs/parallel/jobs.log --rpl {_}\ s/\\//_/g;'
146+
phpunit_cmd='phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-{_}.cov --log-junit build/logs/tmp/{_}.xml --colors=always {}'
147+
echo "$split_tests" | parallel "$phpunit_cmd" || echo "$split_tests" | parallel --retry-failed "$phpunit_cmd"
146148
- run:
147149
name: Merge PHPUnit test reports
148150
command: |-
@@ -154,6 +156,9 @@ jobs:
154156
- store_artifacts:
155157
path: build/logs/phpunit/junit.xml
156158
destination: build/logs/phpunit/junit.xml
159+
- store_artifacts:
160+
path: build/logs/parallel/jobs.log
161+
destination: build/logs/parallel/jobs.log
157162
- persist_to_workspace:
158163
root: build
159164
paths:

0 commit comments

Comments
 (0)