forked from abogoyavlensky/automigrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
116 lines (80 loc) · 2.71 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Styling for output
YELLOW := "\e[1;33m"
NC := "\e[0m"
INFO := @sh -c '\
printf $(YELLOW); \
echo "=> $$1"; \
printf $(NC)' VALUE
DIRS?=src test build.clj
GOALS = $(filter-out $@,$(MAKECMDGOALS))
.SILENT: # Ignore output of make `echo` command
.PHONY: help # Show list of targets with descriptions
help:
@$(INFO) "Commands:"
@grep '^.PHONY: .* #' Makefile | sed 's/\.PHONY: \(.*\) # \(.*\)/\1 > \2/' | column -tx -s ">"
.PHONY: deps # Install deps
deps:
@$(INFO) "Install deps..."
@clojure -P -X:test:dev:outdated
.PHONY: repl # Running repl
repl:
@$(INFO) "Running repl..."
@clj -A:test:dev
.PHONY: lint # Linting code
lint:
@$(INFO) "Linting project..."
@clj-kondo --parallel --lint $(DIRS)
.PHONY: lint-init # Linting code with libraries
lint-init:
@$(INFO) "Linting project's classpath..."
@clj-kondo --parallel --dependencies --copy-configs --lint $(shell clj -Spath)
.PHONY: outdated # Check deps versions
outdated:
@$(INFO) "Checking deps versions..."
@clojure -M:outdated
.PHONY: outdated-fix # Check deps versions and upgrade
outdated-fix:
@$(INFO) "Upgrading deps versions..."
@clojure -M:outdated --upgrade --force
.PHONY: check # Check linting and apply formatting locally
check:
@$(MAKE) fmt
@$(MAKE) lint
@$(MAKE) test
.PHONY: test # Run tests
test:
@$(INFO) "Running tests..."
@clojure -X:dev:test
.PHONY: test-ci # Run tests in CI in fail fast mode
test-ci:
@$(INFO) "Running tests..."
@clojure -X:dev:test :fail-fast? true
# Docker compose
.PHONY: up # Run db, testing db and db admin web UI locally for development
up:
@$(INFO) "Running db..."
@docker compose up -d db test-postgres
# Testing commands
.PHONY: migrations # Making migrations
migrations:
@clojure -A:dev -X:migrations $(GOALS)
# Build and release
.PHONY: install-snapshot # Build and install snapshot of package with next version locally
install-snapshot:
@$(INFO) "Installing a jar locally..."
@clojure -T:build install :snapshot? true :bump $(GOALS)
.PHONY: deploy-snapshot # Build and deploy snapshot of package with next version to Clojars from local machine
deploy-snapshot:
@$(INFO) "Deploying jar-file to Clojars..."
@clojure -T:build deploy :snapshot? true :bump $(GOALS)
.PHONY: deploy-ci # Build and deploy latest version of package to Clojars in CI
deploy-ci:
@$(INFO) "Deploying jar-file to Clojars..."
@clojure -T:build deploy :release? true
.PHONY: next-changelog # Generate draft of changelog for next release. Need to correct by hand!
next-changelog:
@npx auto-changelog --output NEXT-CHANGELOG.md --template keepachangelog
.PHONY: release # Bump tag version and push it to remote repo
release:
@$(INFO) "Deploying jar-file to Clojars..."
@clojure -T:build release :bump $(GOALS)