Skip to content

Commit

Permalink
Improve coveralls in github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NikAzanov committed Oct 7, 2024
1 parent e0e6662 commit 7ea1fa8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 28 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,19 @@ jobs:
poetry run inv ci.prepare
- name: Run checks ${{ matrix.python-version }}
run: poetry run inv pre-commit.run-hooks
- name: Upload results to coveralls
run: |
poetry run pip install coveralls
poetry run coveralls --service=github
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: python ${{ matrix.python-version }} - django ${{ matrix.django-version }}
COVERALLS_PARALLEL: true
- name: Coveralls Upload
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: Python${{ matrix.python-version }} - Django${{ matrix.django-version }}
parallel: true
coveralls-finish:
needs: test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
run: |
pip install coveralls
coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ repos:
stages: [push]
- id: tests
name: run tests
entry: inv ci.coverage
entry: inv pytest.run --params="--cov=."
language: system
pass_filenames: false
types: [python]
Expand Down
9 changes: 0 additions & 9 deletions invocations/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,3 @@ def prepare(context):
saritasa_invocations.docker.up(context)
saritasa_invocations.github_actions.set_up_hosts(context)
saritasa_invocations.poetry.install(context)


@task
def coverage(context):
"""Run tests through coverage to generate coverage report."""
saritasa_invocations.python.run(
context,
command="-m coverage run -m pytest -v",
)
23 changes: 22 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 11 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ factory-boy = "^3.3.1"
# Werkzeug is a comprehensive WSGI web application library
# https://werkzeug.palletsprojects.com/en/3.0.x/
werkzeug = "^3.0.4"
# Tool for measuring code coverage of Python programs
# https://coverage.readthedocs.io/en/7.3.2/
coverage = "^7.6.1"
# This plugin produces coverage reports.
# https://pytest-cov.readthedocs.io/en/latest/index.html
pytest-cov = "^5.0.0"
# Psycopg is a PostgreSQL adapter for the Python
# https://www.psycopg.org/docs/install.html
psycopg2-binary = "^2.9.9"
Expand Down Expand Up @@ -395,6 +395,14 @@ python_files = [
"test_*.py",
"*_tests.py",
]
addopts = [
"--ff",
"--capture=no",
"--verbose",
"--cov-config=pyproject.toml",
"--cov-report=lcov:coverage.lcov",
"--cov-report=term-missing:skip-covered",
]

[tool.coverage.run]
source = [
Expand Down

0 comments on commit 7ea1fa8

Please sign in to comment.