-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (66 loc) · 1.87 KB
/
Copy pathMakefile
File metadata and controls
85 lines (66 loc) · 1.87 KB
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
SHELL := /usr/bin/env bash
.DEFAULT_GOAL := help
define BROWSER_PYSCRIPT
import webbrowser
webbrowser.open("docs/_build/html/index.html")
endef
export BROWSER_PYSCRIPT
define PRINT_HELP_PYSCRIPT
import re, sys
for line in sys.stdin:
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
print("%-40s %s" % (target, help))
endef
export PRINT_HELP_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"
help: ## Print this help
@cat $(MAKEFILE_LIST) | python -c "$$PRINT_HELP_PYSCRIPT"
.PHONY: hooks
hooks:
ln -sf ../../hooks/pre-commit .git/hooks/pre-commit
chmod +x hooks/pre-commit
.PHONY: bootstrap
bootstrap: hooks ## Build development environment
pip install -r requirements.txt
.PHONY: bootstrap-ci
bootstrap-ci: ## Build environment for CI
pip install -r requirements-ci.txt
.PHONY: lint/format
lint/format:
yamllint \
.github/workflows \
modules/plain-repo/files \
.readthedocs.yaml
terraform fmt -check -recursive
.PHONY: lint/validate
lint/validate: init
terraform validate
.PHONY: lint
lint: lint/format ## Check code style and validate Terraform code
.PHONY: format
format: ## Format terraform files
terraform fmt -recursive
.PHONY: init
init:
terraform --version
terraform init
.PHONY: plan
plan: init ## Run terraform plan
set -o pipefail ; terraform plan -parallelism=$$(nproc) -no-color --out=tf.plan 2> plan.stderr | tee plan.stdout || (cat plan.stderr; exit 1)
.PHONY: apply
apply: ## Run terraform apply
terraform apply -auto-approve -parallelism=5 -input=false tf.plan
.PHONY: docs
docs: ## generate Sphinx HTML documentation
# rm -f docs/modules.rst
# sphinx-apidoc -o docs/ twindb_backup
$(MAKE) -C docs clean
$(MAKE) -C docs html
$(BROWSER) docs/_build/html/index.html
.PHONY: clean
clean: ## Remove generated files
rm -fr .terraform
rm -f .terraform.lock.hcl
rm -f plan.stderr plan.stdout tf.plan