-
Notifications
You must be signed in to change notification settings - Fork 297
/
Makefile
67 lines (48 loc) · 2.16 KB
/
Makefile
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
.DEFAULT_GOAL := help
PYTHON_VERSION ?= 3.10
IMAGE = testcontainers-python:${PYTHON_VERSION}
PACKAGES = core $(addprefix modules/,$(notdir $(wildcard modules/*)))
UPLOAD = $(addsuffix /upload,${PACKAGES})
TESTS = $(addsuffix /tests,$(filter-out meta,${PACKAGES}))
TESTS_DIND = $(addsuffix -dind,${TESTS})
DOCTESTS = $(addsuffix /doctests,$(filter-out modules/README.md,${PACKAGES}))
install: ## Set up the project for development
poetry install --all-extras
poetry run pre-commit install
build: ## Build the python package
poetry build && poetry run twine check dist/*
tests: ${TESTS} ## Run tests for each package
${TESTS}: %/tests:
poetry run pytest -v --cov=testcontainers.$* $*/tests
coverage: ## Target to combine and report coverage.
poetry run coverage combine
poetry run coverage report
poetry run coverage xml
poetry run coverage html
lint: ## Lint all files in the project, which we also run in pre-commit
poetry run pre-commit run -a
docs: ## Build the docs for the project
poetry run sphinx-build -nW . docs/_build
# Target to build docs watching for changes as per https://stackoverflow.com/a/21389615
docs-watch :
poetry run sphinx-autobuild . docs/_build # requires 'pip install sphinx-autobuild'
doctests: ${DOCTESTS} ## Run doctests found across the documentation.
poetry run sphinx-build -b doctest . docs/_build
${DOCTESTS}: %/doctests: ## Run doctests found for a module.
poetry run sphinx-build -b doctest -c doctests $* docs/_build
clean: ## Remove generated files.
rm -rf docs/_build
rm -rf build
rm -rf dist
rm -rf */*.egg-info
clean-all: clean ## Remove all generated files and reset the local virtual environment
rm -rf .venv
# Targets that do not generate file-level artifacts.
.PHONY: clean docs doctests image tests ${TESTS}
# Implements this pattern for autodocumenting Makefiles:
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
#
# Picks up all comments that start with a ## and are at the end of a target definition line.
.PHONY: help
help: ## Display command usage
@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'