From 44f86296482241627e29fb8b6e0889aef23ab896 Mon Sep 17 00:00:00 2001 From: Raissa Ferreira Date: Tue, 20 Nov 2018 13:10:03 -0200 Subject: [PATCH] chore: Setup code climate test coverage --- .circleci/config.yml | 16 +++++++++++++++- .gitignore | 1 + README.md | 1 + pytest.ini | 2 +- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1bc0ca1..dd8fdde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,16 +3,30 @@ jobs: build: docker: - image: circleci/python:3.6.1 + environment: + CC_TEST_REPORTER_ID: 9f8a5da723397006023534dc6c5e32fc95d38bf7a92ae0e43530dba2a726722e steps: - checkout - run: command: | sudo apt install python-pip sudo pip install -U pip pipenv + - run: + command: | + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter - run: command: | pipenv --python python3.6 - pipenv install --dev + pipenv install --dev + - run: + command: | + pipenv run pytest + ./cc-test-reporter format-coverage coverage/coverage.xml -t coverage.py + ./cc-test-reporter upload-coverage + - run: + command: | + ./cc-test-reporter before-build - run: command: | pipenv run pytest diff --git a/.gitignore b/.gitignore index 894a44c..7bbb7a8 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,7 @@ pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports +coverage/ htmlcov/ .tox/ .coverage diff --git a/README.md b/README.md index e60848a..c0150f7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![CircleCI](https://circleci.com/gh/rai200890/python_google_cloud_logger.svg?style=svg&circle-token=cdb4c95268aa18f240f607082833c94a700f96e9)](https://circleci.com/gh/rai200890/python_google_cloud_logger) [![PyPI version](https://badge.fury.io/py/google-cloud-logger.svg)](https://badge.fury.io/py/google-cloud-logger) [![Maintainability](https://api.codeclimate.com/v1/badges/e988f26e1590a6591d96/maintainability)](https://codeclimate.com/github/rai200890/python_google_cloud_logger/maintainability) +[![Test Coverage](https://api.codeclimate.com/v1/badges/e988f26e1590a6591d96/test_coverage)](https://codeclimate.com/github/rai200890/python_google_cloud_logger/test_coverage) Python log formatter for Google Cloud according to [v2 specification](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry) using [python-json-logger](https://github.com/madzak/python-json-logger) formatter diff --git a/pytest.ini b/pytest.ini index b898d76..bffdd81 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -addopts = -v -s --cov=google_cloud_logger --cov-report html --cov-report term \ No newline at end of file +addopts = -v -s --cov=google_cloud_logger --cov-report html:coverage --cov-report term --cov-report=xml:coverage/coverage.xml \ No newline at end of file