From 0000d80742f668542add55071d1795b8db5806d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=B6bke?= Date: Thu, 4 Jun 2020 22:03:56 +0200 Subject: [PATCH 1/4] Adding coverage See example in https://github.com/marketplace/actions/codecov Closes #16 --- .github/workflows/python-app.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 3bee5a5..f543ae6 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -42,7 +42,7 @@ jobs: run: | python -m pip install --upgrade pip pip install wheel - pip install flake8 pytest + pip install flake8 pytest coverage - name: Install project dependencies run: | @@ -55,6 +55,14 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest + - name: Test with coverage & pytest run: | - pytest + coverage run --source=tdvisu -m pytest . + coverage xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unittests From da569eececed30df364a79d35747747666687574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=B6bke?= Date: Thu, 4 Jun 2020 22:09:10 +0200 Subject: [PATCH 2/4] More robust read_files For different CI or virtual env. --- setup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ac48784..e30f876 100644 --- a/setup.py +++ b/setup.py @@ -3,6 +3,7 @@ from setuptools import setup from tdvisu.version import __version__ as version +from os.path import join, dirname def read_files(files, delim: str = "\n") -> str: @@ -25,9 +26,12 @@ def read_files(files, delim: str = "\n") -> str: The concatenated string. """ data = [] - for file in files: - with open(file, encoding='utf-8') as handle: - data.append(handle.read()) + try: + for file in files: + with open(join(dirname(__file__), file), encoding='utf-8') as handle: + data.append(handle.read()) + except IOError: + pass return delim.join(data) From bfaa213598e9df6cc570f41b45f526d737cfab4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=B6bke?= Date: Thu, 4 Jun 2020 22:11:03 +0200 Subject: [PATCH 3/4] Partly removed last commit Probably easier to handle Problem if parts of directories get added like in the docstring Every file is a text or byte string giving the name (and the path if the file isn't in the current working directory) --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index e30f876..9d7b945 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,6 @@ from setuptools import setup from tdvisu.version import __version__ as version -from os.path import join, dirname def read_files(files, delim: str = "\n") -> str: @@ -28,7 +27,7 @@ def read_files(files, delim: str = "\n") -> str: data = [] try: for file in files: - with open(join(dirname(__file__), file), encoding='utf-8') as handle: + with open(file, encoding='utf-8') as handle: data.append(handle.read()) except IOError: pass From 9a648f4c5f259e6d70f9fb112b8ae3909d534a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20R=C3=B6bke?= Date: Thu, 4 Jun 2020 22:26:30 +0200 Subject: [PATCH 4/4] Update README.md Added codecov #16 --- README.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 341ee6d..ff7b68f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # TdVisu ![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg) -![Tests](https://github.com/VaeterchenFrost/tdvisu/workflows/Tests/badge.svg) [![PyPI license](https://img.shields.io/pypi/l/tdvisu.svg)](https://pypi.python.org/pypi/tdvisu/) +![Tests](https://github.com/VaeterchenFrost/tdvisu/workflows/Tests/badge.svg) +[![codecov](https://codecov.io/gh/VaeterchenFrost/tdvisu/branch/master/graph/badge.svg)](https://codecov.io/gh/VaeterchenFrost/tdvisu) + ![GitHub release (latest SemVer including pre-releases)](https://img.shields.io/github/v/release/vaeterchenfrost/tdvisu?include_prereleases) [![PyPI version fury.io](https://badge.fury.io/py/tdvisu.svg)](https://pypi.python.org/pypi/tdvisu/) @@ -12,7 +14,7 @@ ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/VaeterchenFrost/tdvisu) ![GitHub commits since latest release (by SemVer)](https://img.shields.io/github/commits-since/VaeterchenFrost/tdvisu/latest) - +---------- Visualization for [dynamic programming](https://en.wikipedia.org/wiki/Dynamic_programming) on [tree decompositions](https://en.wikipedia.org/wiki/Tree_decomposition). @@ -26,6 +28,7 @@ For the portable and light weight '.svg' format, all graphs for a timestep can b With the '.svg' format the images are highly customizable, and even combining several timesteps together using svg [animate](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/animate) would be an option in the future. +---------- # Using [Alubbock:Graphviz](https://anaconda.org/alubbock/graphviz) (or [Graphviz (>=2.38)](https://graphviz.gitlab.io/download/)) @@ -68,6 +71,7 @@ pip install .[test] pytest .\test\ ``` +---------- # How to use @@ -144,3 +148,6 @@ In case any dependencies changed, or just to update some, check in - For details see: [Upload Python Package](https://github.com/VaeterchenFrost/tdvisu/blob/master/.github/workflows/python-app.yml ) **Now you are set for the new release :tada:** + +---------- +