| 1 |
.PHONY: clean-pyc clean-build docs clean test coverage coverage-run clean_all |
| 2 |
SHELL := /bin/bash |
| 3 |
.DEFAULT_GOAL := help |
| 4 |
|
| 5 |
.PHONY: help |
| 6 |
help: |
| 7 |
@mh -f $(MAKEFILE_LIST) $(target) || echo "Please install mh from https://github.com/oz123/mh/releases" |
| 8 |
ifndef target |
| 9 |
@(which mh > /dev/null 2>&1 && echo -e "\nUse \`make help target=foo\` to learn more about foo.") |
| 10 |
endif |
| 11 |
|
| 12 |
help: |
| 13 |
|
| 14 |
clean_all: |
| 15 |
clean |
| 16 |
clean_docs |
| 17 |
clean_coverage_report |
| 18 |
|
| 19 |
clean: clean-build clean-pyc |
| 20 |
|
| 21 |
clean_docs: |
| 22 |
$(MAKE) -C docs clean |
| 23 |
|
| 24 |
clean_coverage_report: |
| 25 |
rm -rf htmlcov/ |
| 26 |
|
| 27 |
clean-build: |
| 28 |
rm -fr build/ |
| 29 |
rm -fr dist/ |
| 30 |
rm -fr *.egg-info |
| 31 |
|
| 32 |
clean-pyc: |
| 33 |
find . -name '*.pyc' -exec rm -f {} + |
| 34 |
find . -name '*.pyo' -exec rm -f {} + |
| 35 |
find . -name '*~' -exec rm -f {} + |
| 36 |
find . -name '__pycache__' -exec rm -rf {} + |
| 37 |
|
| 38 |
lint: |
| 39 |
flake8 pwman scripts |
| 40 |
|
| 41 |
pre-test: |
| 42 |
$(shell sudo service postgresql-9.4 start) |
| 43 |
$(shell sudo service mysql start) |
| 44 |
$(shell sudo service mongodb start) |
| 45 |
|
| 46 |
test-integration: PWMAN_FAILFAST=1 #? stop on first failure |
| 47 |
test-integration: clean install |
| 48 |
python -m tests.test_integration |
| 49 |
|
| 50 |
install-integrationtest-deps: |
| 51 |
pip install -r requirements-integration.txt |
| 52 |
|
| 53 |
install-unittest-deps: |
| 54 |
pip install -r requirements-unittest.txt |
| 55 |
|
| 56 |
test-unit: PWMAN_FAILFAST=1 #? stop on first failure |
| 57 |
test-unit: clean install ## run the unit tests |
| 58 |
python -m tests.test_pwman |
| 59 |
@rm -f tests/test.conf |
| 60 |
|
| 61 |
test-all: OPTS ?="--parallel -o" #? options to pass to tox |
| 62 |
test-all: |
| 63 |
tox $(OPTS) |
| 64 |
|
| 65 |
build-manpage: |
| 66 |
python man-page-builder.py |
| 67 |
|
| 68 |
coverage-run: |
| 69 |
coverage run --append -m tests.test_pwman |
| 70 |
coverage run --append -m tests.test_integration |
| 71 |
coverage report -m |
| 72 |
@coverage html |
| 73 |
|
| 74 |
coverage: coverage-run |
| 75 |
|
| 76 |
docs: |
| 77 |
#rm -f docs/manutils.rst |
| 78 |
#rm -f docs/modules.rst |
| 79 |
sphinx-apidoc -o docs/source/ pwman |
| 80 |
$(MAKE) -C docs clean |
| 81 |
$(MAKE) -C docs html |
| 82 |
xdg-open docs/build/html/index.html |
| 83 |
|
| 84 |
install: |
| 85 |
pip install -e . |
| 86 |
|
| 87 |
docker/build:: TAG ?= latest |
| 88 |
docker/build:: ## build a docker image for pwman3 tests |
| 89 |
docker build -t oz123/pwman3:$(TAG) . |
| 90 |
|
| 91 |
infra-compose:: ## start the infrastructure for the tests |
| 92 |
docker compose --profile infra up -d |
| 93 |
|
| 94 |
test-compose:: ## run all tests in docker compose |
| 95 |
docker compose down -v |
| 96 |
docker compose build |
| 97 |
docker compose up --profile test --abort-on-container-exit |
| 98 |
docker compose down -v |
| 99 |
|
| 100 |
release: |
| 101 |
python -m build |
| 102 |
|
| 103 |
# vim: tabstop=4 shiftwidth=4 |