-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
99 lines (82 loc) · 3.47 KB
/
Makefile
File metadata and controls
99 lines (82 loc) · 3.47 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
93
94
95
96
97
98
99
.PHONY: build install install-dev install-docs test format lint security docs clean help
POETRY := poetry
help:
@echo "Available targets:"
@echo " build - Build the package"
@echo " install - Install the package and dependencies"
@echo " install-dev - Install the package and dev dependencies"
@echo " test - Run tests"
@echo " format - Format code with ruff"
@echo " lint - Run linting checks"
@echo " security - Run security checks with bandit"
@echo " docs - Build the documentation"
@echo " clean - Clean build artifacts and cache"
@echo " help - Show this help message"
build: install-dev
$(POETRY) build
install:
$(POETRY) install
install-dev:
which $(POETRY) || pip install poetry
$(POETRY) install --with dev
install-docs: install-dev
$(POETRY) install --with dev,docs
install-test: install-dev
@if [ ! -f ./test-data/zot ]; then \
if [ "$(shell uname)" = "Darwin" ] && [ "$(shell uname -m)" = "arm64" ]; then \
curl -L -o ./test-data/zot https://github.com/project-zot/zot/releases/download/v2.1.0/zot-darwin-arm64; \
elif [ "$(shell uname)" = "Linux" ] && [ "$(shell uname -m)" = "x86_64" ]; then \
curl -L -o ./test-data/zot https://github.com/project-zot/zot/releases/download/v2.1.0/zot-linux-amd64; \
else \
echo "Unsupported platform or architecture"; \
exit 1; \
fi; \
fi
chmod +x ./test-data/zot
rm -rf test-data/gardenlinux
git submodule update --init --recursive
test: install-test
$(POETRY) run pytest -k "not kms"
test-coverage: install-test
$(POETRY) run pytest -k "not kms" --cov=gardenlinux --cov-report=html tests/
test-coverage-ci: install-test
$(POETRY) run pytest -k "not kms" --cov=gardenlinux --cov-report=xml --cov-fail-under=85 tests/
test-debug: install-test
$(POETRY) run pytest -k "not kms" -vvv -s
test-trace: install-test
$(POETRY) run pytest -k "not kms" -vvv --log-cli-level=DEBUG
format: install-dev
$(POETRY) run -c .pre-commit-config.ruff.yaml --all-files
lint: install-dev
@echo
@echo "------------------------------------------------------------------------------------------------------------------------"
@echo "--// ISORT //-----------------------------------------------------------------------------------------------------------"
@echo "------------------------------------------------------------------------------------------------------------------------"
$(POETRY) run isort --check-only .
@echo
@echo "------------------------------------------------------------------------------------------------------------------------"
@echo "--// PRE-COMMIT //------------------------------------------------------------------------------------------------------"
@echo "------------------------------------------------------------------------------------------------------------------------"
$(POETRY) run pre-commit run --all-files
security: install-dev
@if [ "$(CI)" = "true" ]; then \
$(POETRY) run bandit -c pyproject.toml -ll -ii -r . -f json -o bandit-report.json ; \
else \
$(POETRY) run bandit -c pyproject.toml -r . ; \
fi
docs: install-docs
$(POETRY) run sphinx-build docs _build
clean:
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf .eggs/
rm -rf .pytest_cache/
rm -rf .coverage
rm -rf htmlcov/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
rm -rf test-data/zot
cd test-data/gardenlinux && git reset --hard