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 = src
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: [main]
pull_request:
branches: [main]
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ __pycache__
git_diff_exists
commit_message.txt
black_output.txt
.coverage.*
.coverage
coverage.xml
15 changes: 14 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 @@ -22,6 +22,19 @@ lint: venv
install:
pipx install --force --editable .


export COVERAGE_PROCESS_START = $(PWD)/.coveragerc
coverage:
uv run coverage erase
uv run coverage run --parallel-mode -m pytest
uv run bash tests/run-lint-tests.sh
uv run bash tests/run-format-tests.sh
uv run bash tests/run-shell-tests.sh
uv run bash tests/run-up-validate-tests.sh
uv run coverage combine
uv run coverage report --fail-under=50
uv run coverage xml

check: venv format lint
uv run pytest
uv run bash tests/run-lint-tests.sh
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ venv = ".venv"
dev = [
"flake8>=7.1.2",
"pytest>=8.3.4",
"coverage; python_version >= '3.10'",
]
Loading