Skip to content

Instantly share code, notes, and snippets.

@paulmwatson
Created August 1, 2017 11:08
Show Gist options
  • Save paulmwatson/276ac38c406405c7798f298a48033fe9 to your computer and use it in GitHub Desktop.
Save paulmwatson/276ac38c406405c7798f298a48033fe9 to your computer and use it in GitHub Desktop.
A CircleCI 2.0 configuration for getting code coverage from PHPUnit to Code Climate
version: 2
jobs:
build:
environment:
CC_TEST_REPORTER_ID: YOUR_CODE_CLIMATE_REPORTER_ID
docker:
- image: notnoopci/php:7.1.5-browsers
working_directory: ~/repo
steps:
- checkout
- run: sudo pecl channel-update pecl.php.net
- run: sudo pecl install xdebug && sudo docker-php-ext-enable xdebug
- run: curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- run: chmod +x ./cc-test-reporter
- run: sudo mkdir -p $CIRCLE_TEST_REPORTS/phpunit
- run: ./cc-test-reporter before-build
- run: sudo vendor/bin/phpunit --coverage-clover clover.xml
- run: ./cc-test-reporter after-build -t clover --exit-code $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment