Skip to content

Commit 941533a

Browse files
dev: practicalli standard makefile tasks
1 parent c23127f commit 941533a

File tree

1 file changed

+53
-26
lines changed

1 file changed

+53
-26
lines changed

Makefile

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,46 @@
1-
# ------------------------------------------
2-
# Practicalli: Makefile
1+
# -------------------------------------- #
2+
# Practicalli Makefile
33
#
44
# Consistent set of targets to support local book development
5-
# ------------------------------------------
5+
# -------------------------------------- #
66

7+
# -- Makefile task config -------------- #
78
# .PHONY: ensures target used rather than matching file name
89
# https://makefiletutorial.com/#phony
910
.PHONY: all clean docs lint pre-commit-check test
11+
# -------------------------------------- #
1012

11-
# ------- Makefile Variables --------- #
13+
# -- Makefile Variables ---------------- #
1214
# run help if no target specified
1315
.DEFAULT_GOAL := help
14-
SHELL := /usr/bin/zsh
15-
1616
# Column the target description is printed from
1717
HELP-DESCRIPTION-SPACING := 24
1818

19+
SHELL := /usr/bin/zsh
20+
1921
# Tool Commands
2022
MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
2123
MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
2224
OUTDATED_FILE := outdated-$(shell date +%y-%m-%d-%T).md
25+
# -------------------------------------- #
2326

24-
# Makefile file and directory name wildcard
25-
EDN-FILES := $(wildcard *.edn)
26-
# ------------------------------------ #
27-
28-
# ------ Quality Checks ------------ #
27+
# -- Quality Checks ------------------ #
2928
pre-commit-check: lint
3029

3130
lint: ## Run MegaLinter with custom configuration (node.js required)
32-
$(info --------- MegaLinter Runner ---------)
31+
$(info -- MegaLinter Runner ---------------------)
3332
$(MEGALINTER_RUNNER)
3433

35-
lint-fix: ## Run MegaLinter with custom configuration (node.js required)
36-
$(info --------- MegaLinter Runner ---------)
34+
lint-fix: ## Run MegaLinter with applied fixes and custom configuration (node.js required)
35+
$(info -- MegaLinter Runner fix errors ----------)
3736
$(MEGALINTER_RUNNER) --fix
3837

3938
lint-clean: ## Clean MegaLinter report information
40-
$(info --------- MegaLinter Clean Reports ---------)
39+
$(info -- MegaLinter Clean Reports --------------)
4140
- rm -rf ./megalinter-reports
4241

4342
megalinter-upgrade: ## Upgrade MegaLinter config to latest version
44-
$(info --------- MegaLinter Upgrade Config ---------)
43+
$(info -- MegaLinter Upgrade Config -------------)
4544
npx mega-linter-runner@latest --upgrade
4645

4746
dependencies-outdated: ## Report new versions of library dependencies and GitHub action
@@ -51,31 +50,59 @@ dependencies-outdated: ## Report new versions of library dependencies and GitHub
5150
dependencies-update: ## Update all library dependencies and GitHub action
5251
$(info -- Search for outdated libraries ---------)
5352
- clojure -T:update/dependency-versions > $(OUTDATED_FILE)
54-
# ------------------------------------ #
53+
# -------------------------------------- #
54+
55+
# --- Documentation Generation -------- #
56+
python-venv: ## Create Python Virtual Environment
57+
$(info -- Create Python Virtual Environment --)
58+
python3 -m venv ~/.local/venv
5559

56-
# --- Documentation Generation ------ #
57-
python-venv: ## Enable Python Virtual Environment for MkDocs
58-
$(info --------- Mkdocs Local Server ---------)
60+
python-activate: ## Activate Python Virtual Environment for MkDocs
61+
$(info -- Mkdocs Local Server ----------------)
5962
source ~/.local/venv/bin/activate
6063

64+
mkdocs-install:
65+
$(info -- Install Material for MkDocs -----------)
66+
source ~/.local/venv/bin/activate && pip install mkdocs-material mkdocs-callouts mkdocs-glightbox mkdocs-git-revision-date-localized-plugin mkdocs-redirects mkdocs-rss-plugin pillow cairosvg --upgrade
67+
6168
docs: ## Build and run mkdocs in local server (python venv)
62-
$(info --------- Mkdocs Local Server ---------)
69+
$(info -- MkDocs Local Server -------------------)
6370
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER)
6471

6572
docs-changed: ## Build only changed files and run mkdocs in local server (python venv)
66-
$(info --------- Mkdocs Local Server ---------)
73+
$(info -- Mkdocs Local Server -------------------)
6774
source ~/.local/venv/bin/activate && $(MKDOCS_SERVER) --dirtyreload
6875

6976
docs-build: ## Build mkdocs (python venv)
70-
$(info --------- Mkdocs Local Server ---------)
77+
$(info -- Mkdocs Build Website ------------------)
7178
source ~/.local/venv/bin/activate && mkdocs build
72-
# ------------------------------------ #
7379

74-
# ------------ Help ------------------ #
80+
docs-debug: ## Run mkdocs local server in debug mode (python venv)
81+
$(info -- Mkdocs Local Server Debug -------------)
82+
. ~/.local/venv/bin/activate; $(MKDOCS_SERVER) -v
83+
84+
docs-staging: ## Deploy to staging repository
85+
$(info -- Mkdocs Staging Deploy ---------------)
86+
source ~/.local/venv/bin/activate && mkdocs gh-deploy --force --no-history --config-file mkdocs-staging.yml
87+
# -------------------------------------- #
88+
89+
# ------- Version Control -------------- #
90+
git-sr: ## status list of git repos under current directory
91+
$(info -- Multiple Git Repo Status --------------)
92+
mgitstatus -e --flatten
93+
94+
git-status: ## status details of git repos under current directory
95+
$(info -- Multiple Git Status -------------------)
96+
mgitstatus
97+
# -------------------------------------- #
98+
99+
# ------------ Help -------------------- #
75100
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
76101

77102
help: ## Describe available tasks in Makefile
78103
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
79104
sort | \
80105
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
81-
# ------------------------------------ #
106+
# -------------------------------------- #
107+
108+
dist: deps-build ## Build mkdocs website

0 commit comments

Comments
 (0)