Skip to content

Commit

Permalink
WIP: test codeclimate upload
Browse files Browse the repository at this point in the history
  • Loading branch information
rohanpm committed Mar 1, 2019
1 parent a8adcaf commit 774eab1
Showing 1 changed file with 79 additions and 0 deletions.
79 changes: 79 additions & 0 deletions .circleci/config.yml
Expand Up @@ -52,6 +52,13 @@ workflows:
context: secrets
filters:
<<: *ci_filters
- codeclimate-upload-coverage:
name: Submit coverage results to codeclimate
requires:
- Python 2.7 tests
- Python 3.6 tests
filters:
<<: *ci_filters
- python/release:
name: Release to PyPI
# For twine credentials
Expand All @@ -65,3 +72,75 @@ workflows:
- Build docs
filters:
<<: *ci_filters

jobs:

codeclimate-upload-coverage:
description: |-
Submit coverage data to codeclimate
environment:
CC_TEST_REPORTER_ID: d02a1b5b6e33a7225c7c9e39145d3e89dc984a56e465bac4f9d276bba6ee4b84

executor: python/python36

steps:
- cc_test_reporter
- python/pip_user_install:
requirements: coverage

- checkout

- attach_workspace:
at: /tmp/workspace

- run:
name: codeclimate submit
command: |-
set -xe
i=1
while true; do
set -- /tmp/workspace/coverage.*
mv "$1" .coverage
~/.local/bin/coverage xml
cc-test-reporter format-coverage -o /tmp/codeclimate-$i.json
i=$(expr $i + 1)
rm -f coverage.xml
if test "$#" -eq 1; then
break
fi
done
cc-test-reporter sum-coverage /tmp/codeclimate-*.json
cc-test-reporter upload-coverage
commands:

cc_test_reporter:

parameters:

version:
type: string
default: 0.6.3

steps:
- restore_cache:
name: Restore cc-test-reporter cache
key: v1-cc-test-reporter-<< parameters.version >>

- run:
name: Install cc-test-reporter
command: -|
if ! test -f /opt/cc-test-reporter/test-reporter-<< parameters.version >>-linux-amd64; then
mkdir -p /opt/cc-test-reporter
cd /opt/cc-test-reporter
curl -LO https://codeclimate.com/downloads/test-reporter/test-reporter-<< parameters.version >>-linux-amd64
chmod +x test-reporter-<< parameters.version >>-linux-amd64
fi
ln -sf /opt/cc-test-reporter/test-reporter-<< parameters.version >>-linux-amd64 /usr/local/bin/cc-test-reporter

- save_cache:
name: Save cc-test-reporter cache
key: v1-cc-test-reporter-<< parameters.version >>
paths:
- /opt/cc-test-reporter

0 comments on commit 774eab1

Please sign in to comment.