-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
67 lines (55 loc) · 1.87 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
CI := $(if $(CI),yes,no)
SHELL := /bin/bash
ifeq ($(CI), yes)
POETRY_OPTS = "-v"
PRE_COMMIT_OPTS = --show-diff-on-failure --verbose
endif
help: ## show this message
@awk \
'BEGIN {FS = ":.*##"; printf "\nUsage: make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-30s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) }' \
$(MAKEFILE_LIST)
fix: run-pre-commit ## run all automatic fixes
fix-md: ## automatically fix markdown files
@poetry run pre-commit run mdformat --all-files
lint: ## run all linters
@if [ $${CI} ]; then \
echo ""; \
echo "skipped linters that have dedicated jobs"; \
else \
echo ""; \
$(MAKE) --no-print-directory lint-shellcheck; \
fi
# cspell:ignore EPEL
lint-shellcheck: ## lint shell scripts using shellcheck
@echo "Running shellcheck..."
@if [ -z "$(command -v shellcheck)" ]; then \
find ./scripts -name "*.sh" -type f -print0 | xargs -0r shellcheck; \
else \
echo "shellcheck not installed - install it to lint bash scripts"; \
echo " - Debian: apt install shellcheck"; \
echo " - EPEL: yum -y install epel-release && yum install ShellCheck"; \
echo " - macOS: brew install shellcheck"; \
fi;
@echo ""
run-pre-commit: ## run pre-commit for all files
@poetry run pre-commit run $(PRE_COMMIT_OPTS) \
--all-files \
--color always
setup: setup-poetry setup-pre-commit setup-npm ## setup local dev environment
setup-npm: ## install node dependencies
@npm ci
setup-poetry: ## setup python virtual environment
@poetry install $(POETRY_OPTS) --sync
setup-pre-commit: ## install pre-commit git hooks
@poetry run pre-commit install
spellcheck: ## run cspell
@echo "Running cSpell to checking spelling..."
@npm exec --no -- cspell lint . \
--color \
--config .vscode/cspell.json \
--dot \
--gitignore \
--must-find-files \
--no-progress \
--relative \
--show-context