-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
175 lines (150 loc) · 6.69 KB
/
Copy pathMakefile
File metadata and controls
175 lines (150 loc) · 6.69 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
.PHONY: help run build preview publish transform aggregate aggregate-repo aggregate-update-repo aggregate-repo-single aggregate-update-repo-single test-aggregate-local clean clean-projects clean-aggregated-git test test-unit test-integration check spelling linkcheck woke glossary glossary-check format
help:
@echo "Garden Linux Documentation Hub - Available targets:"
@echo ""
@echo " Development:"
@echo " run - Run docs development server"
@echo " build - Build documentation for test purposes"
@echo " transform - Run transformation on aggregated docs (may leave work tree 'dirty')"
@echo " preview - Preview production build locally"
@echo " publish - Build documentation with transformation for publishing"
@echo ""
@echo " Testing:"
@echo " test - Run full test suite (unit + integration)"
@echo " test-unit - Run unit tests only"
@echo " test-integration - Run integration tests only"
@echo ""
@echo " Quality Checks:"
@echo " check - Run all quality checks (spelling, links, inclusive language)"
@echo " spelling - Check spelling with codespell"
@echo " linkcheck - Check links with lychee"
@echo " woke - Check inclusive language with woke"
@echo " glossary - Process glossary links in documentation"
@echo " glossary-check - Validate glossary structure"
@echo ""
@echo " Documentation Aggregation:"
@echo " aggregate-local - Aggregate from local repos (file:// URLs in repos-config.local.json)"
@echo " aggregate - Aggregate from locked commits (repos-config.json)"
@echo " aggregate-update - Fetch latest from remotes and update commit locks"
@echo " aggregate-repo - Aggregate all repos, overrides scoped to REPO (usage: make aggregate-repo REPO=gardenlinux [REF=branch] [COMMIT=hash])"
@echo " aggregate-update-repo - Same as aggregate-repo plus update commit locks"
@echo " aggregate-repo-single - Aggregate only REPO (usage: make aggregate-repo-single REPO=gardenlinux [REF=branch] [COMMIT=hash])"
@echo " aggregate-update-repo-single - Aggregate only REPO and update its commit lock (same optional REF/COMMIT)"
@echo ""
@echo " Utilities:"
@echo " clean - Clean aggregated docs and build artifacts"
@echo ""
install:
@echo "Installing dependencies..."
pnpm install
pip install git+https://github.com/gardenlinux/glrd.git@v4.1.0
# Install python-gardenlinux-lib from the same commit the aggregation
# documents (see repos-config.json). This keeps the installed gardenlinux
# module in sync with the fetched source so Sphinx autodoc can import
# gardenlinux.* (e.g. oci -> podman, distro_version -> semver) and generate
# the CLI/API reference pages. Pinning an older release tag here drops
# those deps and breaks the python-gardenlinux-lib-cli reference.
pip install git+https://github.com/gardenlinux/python-gardenlinux-lib.git@2a27700198bc91e0f9b8321960ebc4709d65c41a
pip install -r requirements.txt
# Documentation Aggregation
aggregate-local:
@echo "Aggregating from local repositories (relative paths)..."
python3 src/aggregate.py --config repos-config.local.json
aggregate:
@echo "Aggregating documentation from locked source repositories..."
python3 src/aggregate.py
aggregate-update:
@echo "Aggregating documentation from latest source repositories..."
python3 src/aggregate.py --update-locks
aggregate-repo:
@if [ -z "$(REPO)" ]; then \
echo "Error: REPO variable not set"; \
echo "Usage: make aggregate-repo REPO=gardenlinux [REF=branch] [COMMIT=hash]"; \
exit 1; \
fi
@echo "Aggregating all repositories with overrides scoped to: $(REPO)"
python3 src/aggregate.py --repo $(REPO) \
$(if $(REF),--override-ref $(REF)) \
$(if $(COMMIT),--override-commit $(COMMIT))
aggregate-update-repo:
@if [ -z "$(REPO)" ]; then \
echo "Error: REPO variable not set"; \
echo "Usage: make aggregate-update-repo REPO=gardenlinux [REF=branch] [COMMIT=hash]"; \
exit 1; \
fi
@echo "Aggregating all repositories with overrides scoped to: $(REPO) (updating locks)"
python3 src/aggregate.py --update-locks --repo $(REPO) \
$(if $(REF),--override-ref $(REF)) \
$(if $(COMMIT),--override-commit $(COMMIT))
aggregate-repo-single:
@if [ -z "$(REPO)" ]; then \
echo "Error: REPO variable not set"; \
echo "Usage: make aggregate-repo-single REPO=gardenlinux [REF=branch] [COMMIT=hash]"; \
exit 1; \
fi
@echo "Aggregating single repository: $(REPO)"
python3 src/aggregate.py --repo $(REPO) --single \
$(if $(REF),--override-ref $(REF)) \
$(if $(COMMIT),--override-commit $(COMMIT))
aggregate-update-repo-single:
@if [ -z "$(REPO)" ]; then \
echo "Error: REPO variable not set"; \
echo "Usage: make aggregate-update-repo-single REPO=gardenlinux [REF=branch] [COMMIT=hash]"; \
exit 1; \
fi
@echo "Aggregating single repository: $(REPO) (updating lock)"
python3 src/aggregate.py --repo $(REPO) --single --update-locks \
$(if $(REF),--override-ref $(REF)) \
$(if $(COMMIT),--override-commit $(COMMIT))
run:
pnpm run docs:dev
build: install clean aggregate
pnpm run docs:build
transform: glossary
@echo "Transforming content. This may have lead to an unclean worktree and is completely normal."
publish: install clean aggregate glossary
pnpm run docs:build
preview:
pnpm run docs:preview
format:
black src/ tests/
isort src/ tests/
# Testing
test: test-unit test-integration
@echo "All tests passed!"
test-unit:
@echo "Running unit tests..."
python3 -m pytest tests/unit/ -v
test-integration:
@echo "Running integration tests..."
python3 -m pytest tests/integration/ -v
# Quality Checks
check: spelling linkcheck woke
@echo "All quality checks passed!"
spelling:
@echo "Running spelling checks..."
@pnpm run docs:spelling
linkcheck:
@echo "Running link checks..."
@pnpm run docs:linkcheck
woke:
@echo "Running inclusive language checks..."
@pnpm run docs:woke
glossary:
@echo "Processing glossary links..."
@python3 src/aggregation/auto_glossary.py docs/
glossary-check:
@echo "Validating glossary structure..."
@python3 src/aggregation/auto_glossary.py docs/ --check
# Utilities
clean:
@echo "Cleaning build artifacts and aggregated docs..."
rm -rf docs/.vitepress/dist
rm -rf docs/.vitepress/cache
@# Clean aggregated (untracked) content from section directories, preserving git-tracked files
@if [ -d .git ]; then \
git clean -fdX docs/contributing/ docs/explanation/ docs/how-to/ docs/reference/ docs/tutorials/ 2>/dev/null || true; \
else \
rm -rf docs/contributing docs/explanation docs/how-to docs/reference docs/tutorials; \
fi
@echo "Clean complete!"