16
16
# - mega-linter-runner
17
17
#
18
18
# ------------------------------------------
19
-
20
-
21
-
22
19
# .PHONY: ensures target used rather than matching file name
23
20
# https://makefiletutorial.com/#phony
24
21
.PHONY : all lint deps dist pre-commit-check repl test clean
25
22
26
-
27
23
# ------- Makefile Variables --------- #
28
-
29
24
# run help if no target specified
30
25
.DEFAULT_GOAL := help
31
26
32
27
# Column the target description is printed from
33
28
HELP-DESCRIPTION-SPACING := 24
34
29
30
+ MEGALINTER_RUNNER = npx mega-linter-runner --flavor java --release beta --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
31
+
35
32
# Makefile file and directory name wildcard
36
33
# EDN-FILES := $(wildcard *.edn)
37
-
38
34
# ------------------------------------ #
39
35
40
-
41
36
# ------- Help ----------------------- #
42
-
43
37
# Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
44
38
45
39
help : # # Describe available tasks in Makefile
46
40
@grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
47
41
sort | \
48
42
awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
49
-
50
43
# ------------------------------------ #
51
44
52
-
53
45
# ------- Clojure Development -------- #
54
-
55
46
repl : # # Run Clojure REPL with rich terminal UI (Rebel Readline)
56
47
$(info --------- Run Rebel REPL ---------)
57
48
clojure -M:test/env:repl/reloaded
@@ -60,27 +51,21 @@ outdated: ## Check deps.edn & GitHub actions for new versions
60
51
$(info --------- Search for outdated libraries ---------)
61
52
clojure -T:search/outdated > outdated-$(date +"%y-%m-%d-%T" ) .org
62
53
63
-
64
54
# deps: deps.edn ## Prepare dependencies for test and dist targets
65
55
# $(info --------- Download test and service libraries ---------)
66
56
# clojure -P -X:build
67
57
68
-
69
58
# dist: deps build-uberjar ## Build and package Clojure service
70
59
# $(info --------- Build and Package Clojure service ---------)
71
60
72
-
73
61
# Remove files and directories after build tasks
74
62
# `-` before the command ignores any errors returned
75
63
clean : # # Clean build temporary files
76
64
$(info --------- Clean Clojure classpath cache ---------)
77
65
- rm -rf ./.cpcache
78
-
79
66
# ------------------------------------ #
80
67
81
-
82
68
# ------- Testing -------------------- #
83
-
84
69
# test-config: ## Print Kaocha test runner configuration
85
70
# $(info --------- Runner Configuration ---------)
86
71
# clojure -M:test/env:test/run --print-config
@@ -93,7 +78,6 @@ clean: ## Clean build temporary files
93
78
# $(info --------- Runner for unit tests ---------)
94
79
# clojure -X:test/env:test/run
95
80
96
-
97
81
# test-all: ## Run all unit tests regardless of failing tests
98
82
# $(info --------- Runner for all unit tests ---------)
99
83
# clojure -X:test/env:test/run :fail-fast? false
@@ -105,10 +89,8 @@ clean: ## Clean build temporary files
105
89
# test-watch-all: ## Run all tests when changes saved, regardless of failing tests
106
90
# $(info --------- Watcher for unit tests ---------)
107
91
# clojure -X:test/env:test/run :fail-fast? false :watch? true
108
-
109
92
# ------------------------------------ #
110
93
111
-
112
94
# -------- Build tasks --------------- #
113
95
# build-config: ## Pretty print build configuration
114
96
# $(info --------- View current build config ---------)
@@ -125,45 +107,33 @@ clean: ## Clean build temporary files
125
107
# build-clean: ## Clean build assets or given directory
126
108
# $(info --------- Clean Build ---------)
127
109
# clojure -T:build clean
128
-
129
110
# ------------------------------------ #
130
111
131
112
# ------- Code Quality --------------- #
132
-
133
113
pre-commit-check : format-check lint test # # Run format, lint and test targets
134
114
135
-
136
115
format-check : # # Run cljstyle to check the formatting of Clojure code
137
116
$(info --------- cljstyle Runner ---------)
138
117
cljstyle check
139
118
140
-
141
119
format-fix : # # Run cljstyle and fix the formatting of Clojure code
142
120
$(info --------- cljstyle Runner ---------)
143
121
cljstyle fix
144
122
145
123
lint : # # Run MegaLinter with custom configuration (node.js required)
146
124
$(info --------- MegaLinter Runner ---------)
147
- npx mega-linter-runner --flavor java --release v7 --env " 'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
148
-
149
- lint-full : # # Run MegaLinter full image with custom configuration (node.js required)
150
- $(info --------- MegaLinter Runner ---------)
151
- npx mega-linter-runner --release v7 --env " 'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
125
+ $(MEGALINTER_RUNNER )
152
126
153
- lint-beta : # # Run MegaLinter beta release with custom configuration (node.js required)
127
+ lint-fix : # # Run MegaLinter with custom configuration (node.js required)
154
128
$(info --------- MegaLinter Runner ---------)
155
- npx mega-linter-runner --flavor java --release beta --env " 'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
156
-
129
+ $(MEGALINTER_RUNNER ) --fix
157
130
158
131
lint-clean : # # Clean MegaLinter report information
159
132
$(info --------- MegaLinter Clean Reports ---------)
160
133
- rm -rf ./megalinter-reports
161
-
162
134
# ------------------------------------ #
163
135
164
-
165
136
# ------- Docker Containers ---------- #
166
-
167
137
# docker-build: ## Build Clojure Service with docker compose
168
138
# $(info --------- Docker Compose Build ---------)
169
139
# docker compose up --build
@@ -176,33 +146,26 @@ lint-clean: ## Clean MegaLinter report information
176
146
# $(info --------- Docker Compose Down ---------)
177
147
# docker-compose down
178
148
179
-
180
149
# swagger-editor: ## Start Swagger Editor in Docker
181
150
# $(info --------- Run Swagger Editor at locahost:8282 ---------)
182
151
# docker compose -f swagger-editor.yml up -d swagger-editor
183
152
184
153
# swagger-editor-down: ## Stop Swagger Editor in Docker
185
154
# $(info --------- Run Swagger Editor at locahost:8282 ---------)
186
155
# docker compose -f swagger-editor.yml down
187
-
188
156
# ------------------------------------ #
189
157
190
-
191
158
# ------ Continuous Integration ------ #
192
-
193
159
# .DELETE_ON_ERROR: halts if command returns non-zero exit status
194
160
# https://makefiletutorial.com/#delete_on_error
195
161
196
-
197
162
# TODO: focus runner on ^:integration` tests
198
163
# test-ci: deps ## Test runner for integration tests
199
164
# $(info --------- Runner for integration tests ---------)
200
165
# clojure -P -X:test/env:test/run
201
166
202
-
203
167
# Run tests, build & package the Clojure code and clean up afterward
204
168
# `make all` used in Docker builder stage
205
169
# .DELETE_ON_ERROR:
206
170
# all: test-ci dist clean ## Call test-ci dist and clean targets, used for CI
207
-
208
171
# ------------------------------------ #
0 commit comments