deb-mock/Makefile
robojerk c33e3aa9ac
Some checks failed
Build Deb-Mock Package / build (push) Successful in 1m36s
Lint Code / Lint All Code (push) Failing after 2s
Test Deb-Mock Build / test (push) Failing after 49s
add container-based linting workflow using Forgejo Container Registry
2025-08-04 03:13:13 +00:00

95 lines
No EOL
3.3 KiB
Makefile

.PHONY: help install install-dev test clean lint format docs
help: ## Show this help message
@echo "Deb-Mock - Debian Package Build Environment"
@echo ""
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
install: ## Install deb-mock (for Debian package build)
@echo "Installation handled by dh-python"
install-dev: ## Install deb-mock with development dependencies
pip install -e .
pip install -r requirements-dev.txt
test: ## Run tests
python -m pytest tests/ -v
test-coverage: ## Run tests with coverage
python -m pytest tests/ --cov=deb_mock --cov-report=html --cov-report=term
lint: ## Run linting checks
@echo "=== Running all linting checks with Docker container ==="
docker run --rm -v $(PWD):/app git.raines.xyz/robojerk/deb-mock-linter:latest /bin/bash -c "\
echo '=== Linting YAML files ===' && \
yamllint .forgejo/workflows/ deb_mock/configs/ test-config.yaml && \
echo '=== Linting Python files ===' && \
source /opt/venv/bin/activate && \
flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503 && \
black --check --line-length=120 deb_mock/ tests/ && \
isort --check-only --profile=black deb_mock/ tests/ && \
echo '=== Linting shell scripts ===' && \
find . -name '*.sh' -exec shellcheck {} \; && \
echo '✅ All linting checks passed!'"
lint-local: ## Run linting checks locally (requires tools installed)
@echo "=== Running Python linting ==="
venv/bin/flake8 deb_mock/ tests/ --max-line-length=120 --ignore=E203,W503
venv/bin/black --check --line-length=120 deb_mock/ tests/
venv/bin/isort --check-only --profile=black deb_mock/ tests/
@echo "=== Running YAML linting ==="
yamllint .forgejo/workflows/ deb_mock/configs/ test-config.yaml
@echo "=== Running shell linting ==="
find . -name "*.sh" -exec shellcheck {} \;
@echo "✅ All linting checks passed!"
format: ## Format code with black
black deb_mock/ tests/
clean: ## Clean build artifacts
rm -rf build/
rm -rf dist/
rm -rf *.egg-info/
rm -rf output/
rm -rf metadata/
find . -type d -name __pycache__ -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
docs: ## Build documentation
cd docs && make html
install-system-deps: ## Install system dependencies (requires sudo)
sudo apt update
sudo apt install -y sbuild schroot debhelper build-essential debootstrap yamllint shellcheck
install-lint-deps: ## Install linting dependencies
python3 -m venv venv
venv/bin/pip install flake8 black isort bandit
sudo apt install -y yamllint shellcheck nodejs npm
sudo npm install -g markdownlint-cli
setup-chroot: ## Setup initial chroot environment (requires sudo)
sudo mkdir -p /var/lib/deb-mock/chroots
sudo mkdir -p /etc/schroot/chroot.d
sudo chown -R $$USER:$$USER /var/lib/deb-mock
build-example: ## Build an example package (requires setup)
deb-mock init-chroot bookworm-amd64
deb-mock build examples/hello_1.0.dsc
check: ## Run all checks (lint, test, format)
$(MAKE) lint
$(MAKE) test
$(MAKE) format
dist: ## Build distribution package
python setup.py sdist bdist_wheel
upload: ## Upload to PyPI (requires twine)
twine upload dist/*
dev-setup: ## Complete development setup
$(MAKE) install-system-deps
$(MAKE) setup-chroot
$(MAKE) install-dev