Skip to content

Commit

Permalink
Merge pull request #2378 from teohhanhui/fix/parallel-phpunit-coverage
Browse files Browse the repository at this point in the history
Fix test splitting for phpunit-coverage job
  • Loading branch information
teohhanhui committed Dec 14, 2018
2 parents f177cfc + 49744ff commit b53bb0b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:
- image: circleci/php:7.2-node-browsers
environment:
SYMFONY_DEPRECATIONS_HELPER: weak_vendors
APP_ENV: test
parallelism: 2
working_directory: ~/api-platform/core
steps:
Expand All @@ -141,8 +140,11 @@ jobs:
- run:
name: Run PHPUnit tests
command: |-
mkdir -p build/logs/tmp build/cov
phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage.cov --log-junit build/logs/tmp/coverage.xml --colors=always
mkdir -p build/logs/parallel build/logs/tmp build/cov
split_tests=$(find tests -name '*Test.php' -not -path 'tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php' | circleci tests split --split-by=timings)
export PARALLEL='-j10% --joblog build/logs/parallel/jobs.log --rpl {_}\ s/\\//_/g;'
phpunit_cmd='phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-{_}.cov --log-junit build/logs/tmp/{_}.xml --colors=always {}'
echo "$split_tests" | parallel "$phpunit_cmd" || echo "$split_tests" | parallel --retry-failed "$phpunit_cmd"
- run:
name: Merge PHPUnit test reports
command: |-
Expand All @@ -154,6 +156,9 @@ jobs:
- store_artifacts:
path: build/logs/phpunit/junit.xml
destination: build/logs/phpunit/junit.xml
- store_artifacts:
path: build/logs/parallel/jobs.log
destination: build/logs/parallel/jobs.log
- persist_to_workspace:
root: build
paths:
Expand Down

0 comments on commit b53bb0b

Please sign in to comment.