-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run tests and coverage with GH Actions (#22)
* Setup actions wf for testing and coverage. * Use tox for testing and coverage for coverage * move tests to src directory * report status with badges in README
- Loading branch information
1 parent
0a0325e
commit 9a7f308
Showing
16 changed files
with
138 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
name: "Test Suite" | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
tests: | ||
name: "Python ${{ matrix.python-version }} on ${{ matrix.os }}" | ||
runs-on: "${{ matrix.os }}" | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
python-version: | ||
- "3.7" | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
|
||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
|
||
- name: "Set up Python" | ||
uses: "actions/setup-python@v3" | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
|
||
- name: "Install dependencies" | ||
run: | | ||
python -m pip install tox tox-gh-actions | ||
- name: "Run tox for ${{ matrix.python-version }}" | ||
run: | | ||
python -m tox | ||
- name: "Upload coverage data" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: covdata | ||
path: .coverage.* | ||
|
||
coverage: | ||
name: Coverage | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Check out the repo" | ||
uses: "actions/checkout@v3" | ||
|
||
- name: "Set up Python" | ||
uses: "actions/setup-python@v3" | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: "Install dependencies" | ||
run: | | ||
python -m pip install tox tox-gh-actions | ||
- name: "Download coverage data" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: covdata | ||
|
||
- name: "Combine" | ||
run: | | ||
python -m tox -e coverage | ||
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])") | ||
echo "total=$TOTAL" >> $GITHUB_ENV | ||
echo "### Total coverage: ${TOTAL}%" >> $GITHUB_STEP_SUMMARY | ||
- name: "Make badge" | ||
uses: schneegans/[email protected] | ||
with: | ||
# GIST_TOKEN is a GitHub personal access token with scope "gist". | ||
auth: ${{ secrets.GIST_TOKEN }} | ||
gistID: 9deb619232c8098b5e15d259ef5ed534 | ||
filename: covbadge.json | ||
label: Coverage | ||
message: ${{ env.total }}% | ||
minColorRange: 50 | ||
maxColorRange: 90 | ||
valColorRange: ${{ env.total }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,7 @@ dist | |
/daltonize.egg-info/ | ||
.ipynb_checkpoints/ | ||
doc/colourmaps.pdf | ||
.vscode | ||
.coverage | ||
.tox | ||
coverage.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__all__ = ['daltonize'] | ||
|
||
__version__ = "0.2.0" |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
pythonpath = . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import setuptools | ||
|
||
import daltonize | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name="daltonize", # Replace with your own username | ||
version="0.1.2", | ||
version=daltonize.__version__, | ||
author="Jörg Dietrich", | ||
author_email="[email protected]", | ||
description="simulate and correct for color blindness in matplotlib figures and images", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[tox] | ||
env_list = | ||
py37,py38,py39,py310,py311,coverage | ||
minversion = 4.0.16 | ||
|
||
[testenv] | ||
deps = | ||
coverage | ||
pytest | ||
commands = | ||
python -m coverage run -p -m pytest | ||
|
||
[testenv:coverage] | ||
basepython = python3.11 | ||
depends = py37,py38,py39,py310,py311 | ||
parallel_show_output = true | ||
commands = | ||
python -m coverage combine | ||
python -m coverage report -m --skip-covered | ||
python -m coverage json | ||
|
||
[coverage:run] | ||
relative_files = True | ||
|
||
[gh-actions] | ||
python = | ||
3.7: py37 | ||
3.8: py38 | ||
3.9: py39 | ||
3.10: py310 | ||
3.11: py311 |