Skip to content

Commit d5e6eb2

Browse files
committed
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.
1 parent 97391a3 commit d5e6eb2

File tree

2 files changed

+36
-5
lines changed

2 files changed

+36
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dist/
1010

1111
# mkdocs documentation
1212
/site
13+
build
1314

1415
# mypy
1516
.mypy_cache/

Makefile

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,37 @@
1-
build:
2-
python -m build
1+
BUILD_DIR= build
2+
SITE_DIR = $(BUILD_DIR)/site
3+
FETCH_DIR = $(BUILD_DIR)/fetched
4+
PACKAGE_DIR = $(BUILD_DIR)/package
35

4-
docs:
5-
mkdocs build
6+
# From: https://github.com/IllustratedMan-code/make-help
7+
help: ## Show this help
8+
@sed -ne "s/^##\(.*\)/\1/p" $(MAKEFILE_LIST)
9+
@printf "────────────────────────`tput bold``tput setaf 2` pulp-docs commands `tput sgr0`───────────────────────────\n"
10+
@sed -ne "/@sed/!s/\(^[^#?=]*:\).*##\(.*\)/`tput setaf 2``tput bold`\1`tput sgr0`\2/p" $(MAKEFILE_LIST)
11+
@printf "───────────────────────────────────────────────────────────────────────\n"
612

7-
.PHONY: docs build
13+
clean: ## Clean the package and docs build artifacts
14+
rm -rf $(BUILD_DIR)
15+
16+
ci: ## Run the component CI workflow. E.g: make ci component=pulp_rpm
17+
ifndef component
18+
$(error component is a required argument. Usage: make ci component=<your-component-name>)
19+
endif
20+
@echo "Running CI for component=$(component)"
21+
@mkdir -p $(BUILD_DIR)
22+
pulp-docs fetch --dest $(FETCH_DIR)
23+
pulp-docs build --site-dir $(BUILD_DIR)/site-$(component) --path $(component)@..:$(FETCH_DIR)
24+
@echo "Built site at: $(BUILD_DIR)/site-$(component)"
25+
26+
docs: ## Build the production ready documentation
27+
@mkdir -p $(BUILD_DIR)
28+
pulp-docs fetch --dest $(FETCH_DIR)
29+
pulp-docs build --site-dir $(SITE_DIR) --path $(FETCH_DIR)
30+
@echo "Built site at: $(SITE_DIR)"
31+
32+
build: ## Build the pulp-docs package
33+
@mkdir -p $(BUILD_DIR)
34+
python -m build -o $(PACKAGE_DIR)
35+
36+
.PHONY: clean ci build help docs
37+
.DEFAULT_GOAL := help

0 commit comments

Comments
 (0)