-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (75 loc) · 3.28 KB
/
Makefile
File metadata and controls
92 lines (75 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# !make
# Copyright 2025 Itential Inc. All Rights Reserved
# GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
.DEFAULT_GOAL := help
.PHONY: test coverage clean lint format ruff-fix security tox \
tox-py310 tox-py311 tox-py312 tox-py313
# The help target displays a help message that includes the avialable targets
# in this `Makefile`. It is the default target if `make` is run without any
# parameters.
help:
@echo "Available targets:"
@echo " clean - Cleans the development environment"
@echo " coverage - Run test coverage report"
@echo " format - Format source files with ruff"
@echo " lint - Run analysis on source files"
@echo " premerge - Run the permerge tests locallly"
@echo " ruff-fix - Run ruff with --fix to auto-fix issues"
@echo " security - Run security analysis using bandit"
@echo " test - Run test suite"
@echo " tox - Run tests across all Python versions (3.10-3.13)"
@echo " tox-py310 - Run tests with Python 3.10"
@echo " tox-py311 - Run tests with Python 3.11"
@echo " tox-py312 - Run tests with Python 3.12"
@echo " tox-py313 - Run tests with Python 3.13"
@echo ""
# The test target will invoke the unit tests using pytest. This target
# requires uv to be installed and the environment created.
test:
uv run pytest tests -v -s
# The coverage target will invoke pytest with coverage support. It will
# display a summary of the unit test coverage as well as output the coverage
# data report
coverage:
uv run pytest --cov=src/asyncplatform --cov-report=term --cov-report=html tests/
# The lint target invokes ruff to run the linter against both the library
# and test code. This target is invoked in the premerge pipeline.
lint:
uv run ruff check src/asyncplatform
uv run ruff check tests
# The security target invokes bandit to run security analysis on the
# source code. It scans for common security vulnerabilities.
security:
uv run bandit -r src/asyncplatform --configfile pyproject.toml
# The clean target will remove build and dev artififacts that are not
# part of the application and get created by other targets.
clean:
@rm -rf .pytest_cache coverage.* htmlcov dist build *.egg-info
@find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
# The format target will format source files using ruff
format:
uv run ruff format src/asyncplatform tests
# The ruff-fix target will run ruff with --fix to automatically fix
# fixable issues in the source code
ruff-fix:
uv run ruff check --fix src/asyncplatform
uv run ruff check --fix tests
# The premerge target will run the permerge tests locally. This is
# the same target that is invoked in the permerge pipeline.
premerge: clean lint security test
# The tox target will run tests across all supported Python versions
# (3.10, 3.11, 3.12, 3.13) using tox with uv integration.
tox:
uv run tox
# The tox-py310 target will run tests specifically with Python 3.10
tox-py310:
uv run tox -e py310
# The tox-py311 target will run tests specifically with Python 3.11
tox-py311:
uv run tox -e py311
# The tox-py312 target will run tests specifically with Python 3.12
tox-py312:
uv run tox -e py312
# The tox-py313 target will run tests specifically with Python 3.13
tox-py313:
uv run tox -e py313