Skip to content

Commit

Permalink
Test with tox and upload coverage to Codecov (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jul 16, 2022
1 parent f9b3734 commit 66aeded
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 8 deletions.
15 changes: 15 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# .coveragerc to control coverage.py

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma:
pragma: no cover

# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
def cherry_pick_cli

[run]
omit =
cherry_picker/__main__.py
22 changes: 15 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: tests

on: [push, pull_request, workflow_dispatch]

env:
FORCE_COLOR: 1

jobs:
test:
strategy:
Expand All @@ -22,17 +25,22 @@ jobs:
# fetch all branches and tags
# ref actions/checkout#448
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: .github/workflows/main.yml
- name: Install package
cache-dependency-path: pyproject.toml
- name: Install tox
run: |
python -m pip install .[dev]
python -m pip install tox
- name: Run tests
run: pytest
run: tox -e py
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
flags: ${{ matrix.os }}
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

release:
needs: test
Expand All @@ -42,7 +50,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: pip
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ requires-python = ">=3.7"
cherry_picker = "cherry_picker.cherry_picker:cherry_pick_cli"

[tool.flit.metadata.requires-extra]
dev = ["pytest"]
dev = ["pytest", "pytest-cov"]
12 changes: 12 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[tox]
envlist =
py{310, 39, 38, 37}
isolated_build = true

[testenv]
passenv =
FORCE_COLOR
extras =
dev
commands =
{envpython} -m pytest --cov cherry_picker --cov-report html --cov-report term --cov-report xml {posargs}

0 comments on commit 66aeded

Please sign in to comment.