tenseleyflow/shithub / b9cbab1

Browse files

S38: Makefile — docs/docs-serve/docs-verify + lint-spdx + verify-api-docs in CI

Authored by espadonne
SHA
b9cbab14c571b50b5580e29b19e30cc1adbd4861
Parents
2d175a5
Tree
c0e10ef

1 changed file

StatusFile+-
M Makefile 27 2
Makefilemodified
@@ -2,7 +2,7 @@
22
 # Targets mirror what CI runs. The Makefile is the source of truth.
33
 
44
 .DEFAULT_GOAL := help
5
-.PHONY: help dev build test test-race lint lint-policy lint-markdown lint-secret-logs fmt tidy clean ci assets install-tools version deploy deploy-check restore-drill bench-staging
5
+.PHONY: help dev build test test-race lint lint-policy lint-markdown lint-secret-logs lint-spdx verify-api-docs fmt tidy clean ci assets install-tools version deploy deploy-check restore-drill bench-staging docs docs-serve docs-verify gen-third-party-notices
66
 
77
 # Build metadata embedded into the binary via -ldflags.
88
 VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
@@ -70,7 +70,7 @@ assets: ## Copy Primer CSS into internal/web/static/ for embedding.
7070
 		echo "warn: .refs/primer-css/dist not found; run 'git clone https://github.com/primer/css .refs/primer-css' first"; \
7171
 	fi
7272
 
73
-ci: lint lint-policy lint-markdown lint-secret-logs test build ## Full CI pipeline (matches .github/workflows/ci.yml).
73
+ci: lint lint-policy lint-markdown lint-secret-logs lint-spdx verify-api-docs test build ## Full CI pipeline (matches .github/workflows/ci.yml).
7474
 	@echo "ci: ok"
7575
 
7676
 lint-policy: ## Enforce policy-package boundary (no inline auth checks in handlers/git/cmd).
@@ -82,6 +82,12 @@ lint-markdown: ## Enforce markdown-package boundary (no goldmark/bluemonday outs
8282
 lint-secret-logs: ## Fail when source emits log lines containing token-prefix patterns.
8383
 	@scripts/lint-secret-logs.sh
8484
 
85
+lint-spdx: ## Verify every Go + shell source carries the SPDX license header.
86
+	@scripts/verify-spdx-headers.sh
87
+
88
+verify-api-docs: ## Fail when an /api/v1 route in code is missing from docs/public/api/.
89
+	@scripts/verify-api-docs.sh
90
+
8591
 bench-small: ## Run the bench harness against $$BENCH_TARGET (default localhost:8080).
8692
 	@go run ./bench -target=$${BENCH_TARGET:-http://localhost:8080} -iters=$${BENCH_ITERS:-20}
8793
 
@@ -175,3 +181,22 @@ restore-drill: ## Run the restore drill on the backup host (must be run via ssh
175181
 bench-staging: ## Run the bench harness against staging (BENCH_TARGET must be set to the staging URL).
176182
 	@if [ -z "$$BENCH_TARGET" ]; then echo "set BENCH_TARGET=https://staging.shithub.example"; exit 2; fi
177183
 	go run ./bench -target=$$BENCH_TARGET -iters=$${BENCH_ITERS:-50}
184
+
185
+# --- docs ---
186
+docs: ## Build the public docs site to build/docs/ via mdBook.
187
+	cd docs/public && mdbook build
188
+
189
+docs-serve: ## Serve the public docs site locally on http://127.0.0.1:3000.
190
+	cd docs/public && mdbook serve --port 3000
191
+
192
+docs-verify: verify-api-docs ## Verify docs are in sync (API routes documented + SPDX headers).
193
+	@$(MAKE) lint-spdx
194
+	@if command -v mdbook >/dev/null 2>&1; then \
195
+		cd docs/public && mdbook build >/dev/null && echo "mdbook build: ok"; \
196
+	else \
197
+		echo "mdbook not installed; skipping site build"; \
198
+	fi
199
+
200
+gen-third-party-notices: ## Regenerate THIRD_PARTY_NOTICES.md from the active go.mod.
201
+	@scripts/gen-third-party-notices.sh > THIRD_PARTY_NOTICES.md
202
+	@echo "gen-third-party-notices: wrote THIRD_PARTY_NOTICES.md"