Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
parallel = True
source = cfbs
concurrency = multiprocessing
sigterm = True
32 changes: 32 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Fetch and upload coverage

on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
coverage:
if: contains(fromJSON('["cfengine","mendersoftware","NorthernTechHQ"]'), github.repository_owner)
runs-on: ubuntu-latest
name: setup-python
env:
PYTHON_VERSION: "3.10"
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install requirements
run: |
python -m pip install --upgrade pip
python -m pip install uv
uv lock --check
uv sync
- name: Run tests and collect coverage
run: make coverage
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@v7
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ cfbs/VERSION
.venv/
.pytest_cache/

# coverage
.coverage.*
.coverage
coverage.xml

# Node / npm:
node_modules/

Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: default format lint install check venv
.PHONY: default format lint install check venv coverage

default: check

Expand All @@ -19,3 +19,13 @@ install:

check: venv format lint
uv run pytest

export COVERAGE_PROCESS_START = $(PWD)/.coveragerc
export COVERAGE_FILE = $(PWD)/.coverage
coverage:
uv run coverage erase
uv run coverage run --parallel-mode -m pytest
uv run bash tests/shell/all.sh
uv run coverage combine
uv run coverage report --fail-under=50
uv run coverage xml
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ venv = ".venv"
dev = [
"flake8>=5.0; python_full_version >= '3.8.1'",
"pytest>=7.0; python_full_version >= '3.8.1'",
"coverage; python_version >= '3.10'",
]
Loading
Loading