Skip to content

Commit

Permalink
Merge 9288803 into 59fc0da
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Hoelzl committed Jul 9, 2018
2 parents 59fc0da + 9288803 commit 7ddf144
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 109 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install:
- pip install coveralls==1.3.0
script:
- make ci
after_script:
- make deploy
after_success:
- coveralls
after_script:
- python ci-results.py
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ release.build:
release.upload: release.build
twine upload ${OPTS} dist/*

.PHONY: depoly.results
deploy.results:
python deploy-results.py

.PHONY: deploy
deploy: deploy.results

.PHONY: env.install
env.install:
python -m pip install -r requirements.txt
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Build Status](https://travis-ci.org/stefanhoelzl/fancy-dict.svg?branch=master)](https://travis-ci.org/stefanhoelzl/fancy-dict)
[![Build Status](https://fancy-dict.readthedocs.io/en/latest/?badge=latest)](http://fancy-dict.readthedocs.io/)
[![Coverage Status](https://coveralls.io/repos/github/stefanhoelzl/fancy-dict/badge.svg?branch=master)](https://coveralls.io/github/stefanhoelzl/fancy-dict?branch=master)
[![Test Status](https://raw.githubusercontent.com/stefanhoelzl/fancy-dict/ci-results/master/tests.png)](https://github.com/stefanhoelzl/fancy-dict/blob/ci-results/master/testresults.tap)
[![Test Status](https://raw.githubusercontent.com/stefanhoelzl/ci-results/fancy-dict/master/tests.png)](https://github.com/stefanhoelzl/ci-results/blob/fancy-dict/master/testresults.tap)

**Extends python dictionaries with merge, load and filter functions**

Expand Down
102 changes: 0 additions & 102 deletions ci-results.py

This file was deleted.

46 changes: 46 additions & 0 deletions deploy-results.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import os

from cico import TravisCI, GitHub
from cico.results import Directory, File, Badge


class TestStatusBadge(Badge):
def __init__(self, tap_file):
results = self.get_test_counts(tap_file)
value = ', '.join('{} {}'.format(name, count)
for name, count in results.items() if count)
color = 'green'
if results['failed']:
color = 'red'
elif results['skipped']:
color = 'orange'
super().__init__('tests', png=True, label='tests', value=value,
default_color=color)

@staticmethod
def get_test_counts(tap_file):
result = {
'passed': 0,
'failed': 0,
'skipped': 0,
}
with open(tap_file, 'r') as result_file:
for line in result_file.readlines():
if '# SKIP' in line:
result['skipped'] += 1
elif line.startswith('ok'):
result['passed'] += 1
elif line.startswith('not ok'):
result['failed'] += 1
return result


TravisCI(
repo=GitHub('stefanhoelzl', 'ci-results', os.environ.get('GITHUB_TOKEN')),
branch='fancy-dict',
results=[
File('testresults.tap'),
Directory('covhtml'),
TestStatusBadge('testresults.tap'),
]
).commit()
6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ pytest-localserver==0.4.1
pytest-cov==2.5.1
pytest-tap==2.2

# automation
anybadge==1.1.1
GitPython==2.1.10
CairoSVG==2.1.3
# deployment
cico==0.1.3

# documentation
Sphinx==1.7.5
Expand Down

0 comments on commit 7ddf144

Please sign in to comment.