Skip to content

Commit 07b3bb9

Browse files
tweak actions and add coverage (#23)
* tweak actions and add coverage * add coverage badge
1 parent fd4ce55 commit 07b3bb9

File tree

5 files changed

+47
-7
lines changed

5 files changed

+47
-7
lines changed

.coveragerc

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
# Docs: https://coverage.readthedocs.org/en/latest/config.html
3+
4+
[run]
5+
branch = False
6+
7+
# If True, stores relative file paths in data file (needed for Github Actions).
8+
# Using this parameter requires coverage>=5.0
9+
relative_files = True

.github/workflows/testing.yml

+24-4
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,36 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v2
3434
- name: Set up Python Env
35-
uses: actions/setup-python@v2.1.4 # FIXME: Use "v2" tag once https://github.com/actions/setup-python/issues/171 is resolved.
35+
uses: actions/setup-python@v2
3636
with:
3737
python-version: ${{ matrix.python-version }}
3838
- name: Display Python version
3939
run: python -c "import sys; print(sys.version)"
4040
- name: Install dependencies
4141
run: |
42-
pip install pytest==3.2.1 pytest-cov==2.5.1
42+
make init
4343
- name: Run Tests
44+
run: |
45+
make test
46+
- name: Upload to Coveralls
4447
env:
45-
PYTHONHASHSEED: "0"
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
COVERALLS_PARALLEL: true
50+
COVERALLS_FLAG_NAME: "${{ matrix.os }}_${{ matrix.python-version }}"
4651
run: |
47-
pytest --cov=vpk tests
52+
coveralls --service=github
53+
54+
coveralls:
55+
name: Finish Coveralls
56+
needs: test
57+
runs-on: ubuntu-latest
58+
container: python:3-slim
59+
steps:
60+
- name: Install coveralls
61+
run: |
62+
pip3 install --upgrade coveralls
63+
- name: Send coverage finish to coveralls.io
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
run: |
67+
coveralls --finish

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ help:
1616
@echo "$$HELPBODY"
1717

1818
init:
19-
pip install pytest==3.2.1 pytest-cov==2.5.1
19+
pip install -r requirements.txt
2020

2121
test:
2222
rm -f .coverage vpk/*.pyc tests/*.pyc
23-
PYTHONHASHSEED=0 pytest --cov=vpk tests
23+
PYTHONHASHSEED=0 pytest --tb=short --cov-config .coveragerc --cov=vpk tests
2424

2525
pylint:
2626
pylint -r n -f colorized vpk || true

README.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
| |pypi| |license| |master_build|
1+
| |pypi| |license| |coverage| |master_build|
22
| |sonar_maintainability| |sonar_reliability| |sonar_security|
33
44
VPK is Valve's file format for storing game assets.
@@ -124,6 +124,10 @@ Check out https://github.com/SteamDatabase/ValveResourceFormat/
124124
:target: https://pypi.python.org/pypi/vpk
125125
:alt: MIT License
126126

127+
.. |coverage| image:: https://img.shields.io/coveralls/ValvePython/vpk/master.svg?style=flat
128+
:target: https://coveralls.io/r/ValvePython/vpk?branch=master
129+
:alt: Test coverage
130+
127131
.. |master_build| image:: https://github.com/ValvePython/vpk/workflows/Tests/badge.svg?branch=master
128132
:target: https://github.com/ValvePython/vpk/actions?query=workflow%3A%22Tests%22+branch%3Amaster
129133
:alt: Build status of master branch

requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
coverage>=5.0; python_version == '2.7' or python_version >= '3.5'
3+
pytest-cov>=2.7.0; python_version == '2.7' or python_version >= '3.5'
4+
5+
# coveralls 2.0 has removed support for Python 2.7 and 3.4
6+
git+https://github.com/andy-maier/coveralls-python.git@andy/add-py27#egg=coveralls; python_version == '2.7'
7+
coveralls>=2.1.2; python_version >= '3.5'

0 commit comments

Comments
 (0)