-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
84 lines (67 loc) · 1.78 KB
/
Makefile
File metadata and controls
84 lines (67 loc) · 1.78 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
SILENT= > /dev/null
SHELL := /usr/bin/env bash -eo pipefail -c
define PREPARE_ENV
source ./.github/gen_env.sh;
endef
###############################################
pre-commit.install:
@pre-commit install && \
pre-commit install --hook-type commit-msg
###############################################
infra.init:
@printf "InitDeploying infrastructure...\n"
${PREPARE_ENV} \
./infra/tf.sh
infra.apply:
@printf "Deploying infrastructure...\n"
${PREPARE_ENV} \
./infra/tf.sh apply
infra.destroy:
@printf "Destroy infrastructure...\n"
${PREPARE_ENV} \
./infra/tf.sh destroy
infra.plan:
@printf "Plan infrastructure...\n"
${PREPARE_ENV} \
./infra/tf.sh plan
###############################################
build:
@printf "Build...\n"
@pushd ./livecraft && \
go build -o livecraft livecraft.go && \
chmod +x livecraft && \
popd
bin.test:
@printf "Test...\n"
@printf "Add permissions...\n"
@chmod +x livecraft/livecraft
@printf "Run tests...\n"
@printf "Run plan...\n"
@livecraft/livecraft infra/tf.sh plan
@printf "Run apply...\n"
@livecraft/livecraft infra/tf.sh apply
@printf "Run destroy...\n"
@livecraft/livecraft infra/tf.sh destroy
go.test :
@printf "Test...\n"
@pushd ./livecraft && \
go test -v ./... && \
popd
###############################################
mr.clean:
@printf "Clean Environment...\n"
@${PREPARE_ENV} \
if [ $${STAGE} == "prod" ]; \
then \
echo "We don't clean PRODUCTION :)"; \
else \
./infra/tf.sh destroy && \
rm -rf ./infra/terraform/.terraform && \
rm -rf ./infra/terraform/terraform.tfstate* && \
rm -rf ./infra/terraform/terraform.lock.hcl && \
rm -rf ./infra/plan/out.plan; \
fi \
###############################################
update-golang:
@printf "Update Golang...\n"
@go get -u ./... && go mod tidy