From d5e6eb209ff75e90af2e1450519b35e3b59f5ee7 Mon Sep 17 00:00:00 2001 From: Pedro Brochado Date: Thu, 12 Jun 2025 17:38:28 -0300 Subject: [PATCH] Add cannonical ci, docs and build command to Makefile The goal of this is to *make* it easy to reproduce CI and production builds locally. --- .gitignore | 1 + Makefile | 40 +++++++++++++++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index a62d06c3..62226e58 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ dist/ # mkdocs documentation /site +build # mypy .mypy_cache/ diff --git a/Makefile b/Makefile index d6d0c55f..7500c79a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,37 @@ -build: - python -m build +BUILD_DIR= build +SITE_DIR = $(BUILD_DIR)/site +FETCH_DIR = $(BUILD_DIR)/fetched +PACKAGE_DIR = $(BUILD_DIR)/package -docs: - mkdocs build +# From: https://github.com/IllustratedMan-code/make-help +help: ## Show this help + @sed -ne "s/^##\(.*\)/\1/p" $(MAKEFILE_LIST) + @printf "────────────────────────`tput bold``tput setaf 2` pulp-docs commands `tput sgr0`───────────────────────────\n" + @sed -ne "/@sed/!s/\(^[^#?=]*:\).*##\(.*\)/`tput setaf 2``tput bold`\1`tput sgr0`\2/p" $(MAKEFILE_LIST) + @printf "───────────────────────────────────────────────────────────────────────\n" -.PHONY: docs build +clean: ## Clean the package and docs build artifacts + rm -rf $(BUILD_DIR) + +ci: ## Run the component CI workflow. E.g: make ci component=pulp_rpm +ifndef component + $(error component is a required argument. Usage: make ci component=) +endif + @echo "Running CI for component=$(component)" + @mkdir -p $(BUILD_DIR) + pulp-docs fetch --dest $(FETCH_DIR) + pulp-docs build --site-dir $(BUILD_DIR)/site-$(component) --path $(component)@..:$(FETCH_DIR) + @echo "Built site at: $(BUILD_DIR)/site-$(component)" + +docs: ## Build the production ready documentation + @mkdir -p $(BUILD_DIR) + pulp-docs fetch --dest $(FETCH_DIR) + pulp-docs build --site-dir $(SITE_DIR) --path $(FETCH_DIR) + @echo "Built site at: $(SITE_DIR)" + +build: ## Build the pulp-docs package + @mkdir -p $(BUILD_DIR) + python -m build -o $(PACKAGE_DIR) + +.PHONY: clean ci build help docs +.DEFAULT_GOAL := help