-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
119 lines (87 loc) · 2.13 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
117
118
119
.PHONY: all
all:
compose = docker compose $(COMPOSE_ARGS)
compose-run = $(compose) run --rm
compose-exec = $(compose) exec -T
compose-cp = docker compose cp
wiki-exec = $(compose-exec) wiki
# ======== Build ========
.PHONY: build
build:
$(compose) build
# ======== Develop ========
.PHONY: bash
bash:
$(compose) exec wiki bash
# ======== Run ========
.PHONY: sqlite-up
sqlite-up:
$(compose) up -d
.PHONY: mysql-up
mysql-up:
MYSQL_HOST=mysql $(compose) --profile mysql up -d
.PHONY: wait-for-wiki
wait-for-wiki:
$(compose-run) wait-for-wiki
.PHONY: show-status
show-status:
$(compose) ps
.PHONY: show-logs
show-logs:
$(compose) logs -f || exit 0
.PHONY: stop
stop:
$(compose) stop
.PHONY: down
down:
$(compose) down
.PHONY: destroy
destroy:
$(compose) down --volumes --remove-orphans
# ======== Backstop ========
backstop = $(compose-run) backstop --config backstop.config.js
.PHONY: backstop-test
backstop-test: wait-for-wiki
$(backstop) test
.PHONY: backstop-approve
backstop-approve:
$(backstop) approve
# ======== Backup ========
backup = $(compose) pull backup && $(compose-run) backup
.PHONY: create-backup
create-backup: wait-for-wiki
$(backup) create
.PHONY: restore-backup
restore-backup: wait-for-wiki
$(backup) restore
# ======== CI ========
.PHONY: ci
ci: down build
$(MAKE) with-ci destroy mysql-up disable-opcache restore-backup backstop-test
$(MAKE) with-ci destroy
$(eval COMPOSE_ARGS = )
.PHONY: with-ci
with-ci:
$(eval COMPOSE_ARGS = -p docker-smw-crc1153-ci)
.PHONY: disable-opcache
disable-opcache:
$(wiki-exec) disable-opcache.sh
# ======== Release ========
VERSION = `sed -n -e 's/^ARG CONFIDENT_VERSION=//p' ./context/Dockerfile`
.PHONY: release
release: ci git-push gh-login
gh release create $(VERSION)
.PHONY: git-push
git-push:
git diff --quiet || (echo 'git directory has changes'; exit 1)
git fetch # make sure we have access to the repository
git push
.PHONY: gh-login
gh-login: require-GH_API_TOKEN
gh config set prompt disabled
@echo $(GH_API_TOKEN) | gh auth login --with-token
.PHONY: require-GH_API_TOKEN
require-GH_API_TOKEN:
ifndef GH_API_TOKEN
$(error GH_API_TOKEN is not set)
endif