|
| 1 | +.PHONY: build install install-dev install-docs test format lint security docs clean help |
| 2 | + |
| 3 | +POETRY := poetry |
| 4 | + |
| 5 | +help: |
| 6 | + @echo "Available targets:" |
| 7 | + @echo " build - Build the package" |
| 8 | + @echo " install - Install the package and dependencies" |
| 9 | + @echo " install-dev - Install the package and dev dependencies" |
| 10 | + @echo " test - Run tests" |
| 11 | + @echo " format - Format code with black" |
| 12 | + @echo " lint - Run linting checks" |
| 13 | + @echo " security - Run security checks with bandit" |
| 14 | + @echo " docs - Build the documentation" |
| 15 | + @echo " clean - Clean build artifacts and cache" |
| 16 | + @echo " help - Show this help message" |
| 17 | + |
| 18 | +build: |
| 19 | + $(POETRY) build |
| 20 | + |
| 21 | +install: |
| 22 | + $(POETRY) install |
| 23 | + |
| 24 | +install-dev: |
| 25 | + $(POETRY) install --with dev |
| 26 | + |
| 27 | +install-docs: |
| 28 | + $(POETRY) install --with dev,docs |
| 29 | + |
| 30 | +test-deps: |
| 31 | + test -f ./test-data/zot || curl -o ./test-data/zot https://github.com/project-zot/zot/releases/download/v2.1.0/zot-linux-amd64 |
| 32 | + chmod +x ./test-data/zot |
| 33 | + |
| 34 | +test: install-dev test-deps |
| 35 | + $(POETRY) run pytest |
| 36 | + |
| 37 | +format: install-dev |
| 38 | + $(POETRY) run black . |
| 39 | + |
| 40 | +lint: install-dev |
| 41 | + $(POETRY) run black --check . |
| 42 | + |
| 43 | +security: install-dev |
| 44 | + @if [ "$(CI)" = "true" ]; then \ |
| 45 | + $(POETRY) run bandit -ll -ii -r . -f json -o bandit-report.json ; \ |
| 46 | + else \ |
| 47 | + $(POETRY) run bandit -r . ; \ |
| 48 | + fi |
| 49 | + |
| 50 | +docs: install-docs |
| 51 | + $(POETRY) run sphinx-build docs _build |
| 52 | + |
| 53 | +clean: |
| 54 | + rm -rf build/ |
| 55 | + rm -rf dist/ |
| 56 | + rm -rf *.egg-info/ |
| 57 | + rm -rf .eggs/ |
| 58 | + rm -rf .pytest_cache/ |
| 59 | + rm -rf .coverage |
| 60 | + rm -rf htmlcov/ |
| 61 | + find . -type d -name __pycache__ -exec rm -rf {} + |
| 62 | + find . -type f -name "*.pyc" -delete |
| 63 | + find . -type f -name "*.pyo" -delete |
| 64 | + find . -type f -name "*.pyd" -delete |
0 commit comments