-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathMakefile
More file actions
91 lines (77 loc) · 2.48 KB
/
Makefile
File metadata and controls
91 lines (77 loc) · 2.48 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
DOCS_IMAGE ?= pulp-docs
.PHONY: help
help:
@echo "COMMANDS:"
@echo " dist-build Build the distribution package"
@echo " dist-test Test the built distribution package"
@echo " docs-image Build the docs container image"
@echo " docs-ci Build docs for COMPONENT's CI"
@echo " docs-prod Build the full production docs site"
@echo " docs-linkcheck Check for broken documentation links"
@echo " test Run the test suite"
@echo " test-integration Run integration tests (USE_EXISTING_SITE=1 to skip build)"
@echo " lint Run pre-commit hooks on all files"
@echo " clean Remove build artifacts and temporary files"
@echo " help Show this help message"
.PHONY: dist-build
dist-build:
python -m build
.PHONY: dist-test
dist-test:
python -m venv venv-dist
venv-dist/bin/pip install dist/pulp_docs*.whl twine
venv-dist/bin/pulp-docs --version
# test mkdocs.yml is accessible via installed package
venv-dist/bin/python -c "from pulp_docs.cli import get_default_mkdocs; assert get_default_mkdocs()"
venv-dist/bin/twine check --strict dist/pulp_docs-*.whl
@echo "Build is fine!"
.PHONY: test
test:
uv run --with-requirements test_requirements.txt pytest
_INTEGRATION_DEPS =
ifndef USE_EXISTING_SITE
_INTEGRATION_DEPS = docs-prod
endif
.PHONY: test-integration
test-integration: $(_INTEGRATION_DEPS)
uv run --with-requirements test_requirements.txt pytest -vv tests/integration/
.PHONY: lint
lint:
pre-commit run -a
.PHONY: docs-linkcheck
docs-linkcheck:
@uv run pulp-linkchecker \
$$(git ls-files | grep '^docs/**/.*md$$') \
&& echo "No broken links found"
.PHONY: docs-image
docs-image:
docker build -t $(DOCS_IMAGE) .
.PHONY: docs-prod
docs-prod: clean docs-image
docker run --rm \
--user $(shell id -u):$(shell id -g) \
-v $(CURDIR):/pulp-docs \
$(DOCS_IMAGE) \
/pulp-docs/ci/scripts/build_docs_prod.sh
# avoid double mount if COMPONENT is pulp-docs
ifeq ($(COMPONENT),pulp-docs)
_COMPONENT_MOUNT =
else
_COMPONENT_MOUNT = -v $(CURDIR)/../$(COMPONENT):/$(COMPONENT)
endif
.PHONY: docs-ci
docs-ci: clean docs-image
ifndef COMPONENT
@echo "Error: COMPONENT is required"
@echo "Usage: make docs-ci COMPONENT=<component-name>"
@exit 1
endif
docker run --rm \
--user $(shell id -u):$(shell id -g) \
-v $(CURDIR):/pulp-docs \
$(_COMPONENT_MOUNT) \
$(DOCS_IMAGE) \
/pulp-docs/ci/scripts/build_docs_ci.sh $(COMPONENT)
.PHONY: clean
clean:
rm -rf dist build venv-dist site