Skip to content

Commit de47527

Browse files
dev: add version control tasks and update format
1 parent 8368647 commit de47527

File tree

6 files changed

+403
-204
lines changed

6 files changed

+403
-204
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).
44

55
# [Unreleased]
6+
## Added
7+
- dev: add version control tasks and update format
68

79
# 2025-10-09
810
## Updated

Makefile

Lines changed: 55 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ HELP-DESCRIPTION-SPACING := 24
3232

3333
SHELL := /usr/bin/zsh
3434

35-
# Tool Commands
35+
# Tool variables
3636
CLOJURE_TEST_RUNNER := clojure -M:test/env:test/run
3737
CLOJURE_EXEC_TEST_RUNNER := clojure -X:test/env:test/run
3838
DOCKER-BUILD-LOGFILE := docker-build-log-$(shell date +%y-%m-%d-%T).md
@@ -147,7 +147,7 @@ build-clean: ## Clean build assets or given directory
147147
clojure -T:build/task clean
148148
# -------------------------------------- #
149149

150-
# -- Quality Checks ------------------ #
150+
# -- Code Quality ---------------------- #
151151
pre-commit-check: format-check lint test ## Run format, lint and test targets
152152

153153
format-check: ## Run cljstyle to check the formatting of Clojure code
@@ -217,6 +217,16 @@ docs-staging: ## Deploy to staging repository
217217
source ~/.local/venv/bin/activate && mkdocs gh-deploy --force --no-history --config-file mkdocs-staging.yml
218218
# -------------------------------------- #
219219

220+
# -- Version Control ------------------- #
221+
git-sr: ## status list of git repos under current directory
222+
$(info -- Multiple Git Repo Status --------------)
223+
mgitstatus -e --flatten
224+
225+
git-status: ## status details of git repos under current directory
226+
$(info -- Multiple Git Status -------------------)
227+
mgitstatus
228+
# -------------------------------------- #
229+
220230
# -- Docker Containers ----------------- #
221231
docker-build: ## Build Clojure project and run with docker compose
222232
$(info -- Docker Compose Build ------------------)
@@ -226,14 +236,50 @@ docker-build-log: ## Build Clojure project and run with docker compose - log to
226236
$(info --------- Docker Compose Build ---------)
227237
docker compose up --build --detach &> $(DOCKER-BUILD-LOGFILE) | tee $(DOCKER-BUILD-LOGFILE)
228238

229-
# -- Version Control ------------------- #
230-
git-sr: ## status list of git repos under current directory
231-
$(info -- Multiple Git Repo Status --------------)
232-
mgitstatus -e --flatten
239+
docker-build-clean: ## Build Clojure project and run with docker compose, removing orphans
240+
$(info -- Docker Compose Build, remove orphans --)
241+
docker compose up --build --remove-orphans --detach
233242

234-
git-status: ## status details of git repos under current directory
235-
$(info -- Multiple Git Status -------------------)
236-
mgitstatus
243+
docker-down: ## Shut down containers in docker compose
244+
$(info -- Docker Compose Down -------------------)
245+
docker compose down
246+
247+
docker-inspect: ## Inspect given docker image - image-id=12e45fg89
248+
$(info -- Docker Image Prune --------------------)
249+
docker inspect --format='{{json .Config}}' $(image-id) | jq
250+
251+
docker-image-prune: ## Prune docker images
252+
$(info -- Docker Image Prune --------------------)
253+
docker image prune
254+
255+
docker-container-prune: ## Prune docker containers
256+
$(info -- Docker Container Prune ----------------)
257+
docker container prune
258+
259+
docker-prune: docker-image-prune docker-image-prune ## Prune docker images and containers
260+
261+
swagger-editor: ## Start Swagger Editor in Docker
262+
$(info -- Run Swagger Editor at locahost:8282 ---)
263+
docker compose -f swagger-editor.yaml up -d swagger-editor --detatch
264+
265+
swagger-editor-down: ## Stop Swagger Editor in Docker
266+
$(info -- Run Swagger Editor at locahost:8282 ---)
267+
docker compose -f swagger-editor.yaml down
268+
# -------------------------------------- #
269+
270+
# -- Continuous Integration ------------ #
271+
# .DELETE_ON_ERROR: halts if command returns non-zero exit status
272+
# https://makefiletutorial.com/#delete_on_error
273+
274+
# TODO: focus runner on ^:integration` tests
275+
test-ci: deps ## Test runner for integration tests
276+
$(info -- Runner for integration tests ---------)
277+
clojure -P -X:test/env:test/run
278+
279+
# Run tests, build & package the Clojure code and clean up afterward
280+
# `make all` used in Docker builder stage
281+
.DELETE_ON_ERROR:
282+
all: test-ci dist clean ## Call test-ci dist and clean targets, used for CI
237283
# -------------------------------------- #
238284

239285
# -- Help ------------------------------ #

resources/practicalli/application/root/Makefile

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,26 @@
2121
# -- Makefile task config -------------- #
2222
# .PHONY: ensures target used rather than matching file name
2323
# https://makefiletutorial.com/#phony
24-
.PHONY: all clean deps dist docs lint pre-commit-check repl test test-ci test-watch
24+
.PHONY: all clean deps dist docs lint pre-commit-check repl test test-ci test-watch
2525
# -------------------------------------- #
2626

2727
# -- Makefile Variables ---------------- #
2828
# run help if no target specified
2929
.DEFAULT_GOAL := help
30-
3130
# Column the target description is printed from
3231
HELP-DESCRIPTION-SPACING := 24
3332

33+
SHELL := /usr/bin/zsh
34+
3435
# Tool variables
3536
CLOJURE_TEST_RUNNER := clojure -M:test/env:test/run
3637
CLOJURE_EXEC_TEST_RUNNER := clojure -X:test/env:test/run
3738
DOCKER-BUILD-LOGFILE := docker-build-log-$(shell date +%y-%m-%d-%T).md
38-
MEGALINTER_RUNNER := npx mega-linter-runner --flavor java --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
39+
MEGALINTER_RUNNER := npx mega-linter-runner --flavor java --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
3940
OUTDATED_FILE := outdated-$(shell date +%y-%m-%d-%T).md
4041

4142
# Makefile file and directory name wildcard
4243
# EDN-FILES := $(wildcard *.edn)
43-
# ------------------------------------ #
44-
45-
# -- Help ------------------------------ #
46-
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
47-
48-
help: ## Describe available tasks in Makefile
49-
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
50-
sort | \
51-
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
5244
# -------------------------------------- #
5345

5446
# -- Clojure Workflow ------------------ #
@@ -110,15 +102,15 @@ test-watch-all: ## Run all tests when changes saved, regardless of failing test
110102

111103
# -- Build tasks ----------------------- #
112104
build-config: ## Pretty print build configuration
113-
$(info --------- View current build config ------)
105+
$(info -- View current build config -------------)
114106
clojure -T:build/task config
115107

116108
build-jar: ## Build a jar archive of Clojure project
117-
$(info --------- Build library jar --------------)
109+
$(info -- Build library jar ---------------------)
118110
clojure -T:build/task jar
119111

120112
build-uberjar: ## Build a uberjar archive of Clojure project & Clojure runtime
121-
$(info --------- Build service Uberjar ---------)
113+
$(info -- Build service Uberjar ----------------)
122114
clojure -T:build/task uberjar
123115

124116
build-uberjar-echo: ## Build a uberjar archive of Clojure project & Clojure runtime
@@ -155,9 +147,27 @@ lint-clean: ## Clean MegaLinter report information
155147
$(info -- MegaLinter Clean Reports --------------)
156148
- rm -rf ./megalinter-reports
157149

158-
megalinter-upgrade: ## Update MegaLinter config to latest version
159-
$(info --------- MegaLinter Upgrade Config ---------)
150+
megalinter-upgrade: ## Upgrade MegaLinter config to latest version
151+
$(info -- MegaLinter Upgrade Config -------------)
160152
npx mega-linter-runner@latest --upgrade
153+
154+
dependencies-outdated: ## Report new versions of library dependencies and GitHub action
155+
$(info -- Search for outdated libraries ---------)
156+
- clojure -T:search/outdated > $(OUTDATED_FILE)
157+
158+
dependencies-update: ## Update all library dependencies and GitHub action
159+
$(info -- Search for outdated libraries ---------)
160+
- clojure -T:update/dependency-versions > $(OUTDATED_FILE)
161+
# -------------------------------------- #
162+
163+
# -- Version Control ------------------- #
164+
git-sr: ## status list of git repos under current directory
165+
$(info -- Multiple Git Repo Status --------------)
166+
mgitstatus -e --flatten
167+
168+
git-status: ## status details of git repos under current directory
169+
$(info -- Multiple Git Status -------------------)
170+
mgitstatus
161171
# -------------------------------------- #
162172

163173
# -- Docker Containers ----------------- #
@@ -214,3 +224,13 @@ test-ci: deps ## Test runner for integration tests
214224
.DELETE_ON_ERROR:
215225
all: test-ci dist clean ## Call test-ci dist and clean targets, used for CI
216226
# -------------------------------------- #
227+
228+
# -- Help ------------------------------ #
229+
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
230+
231+
help: ## Describe available tasks in Makefile
232+
@grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \
233+
sort | \
234+
awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
235+
# -------------------------------------- #
236+

0 commit comments

Comments
 (0)