forked from OpenSlides/OpenSlides
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (107 loc) · 4.88 KB
/
Makefile
File metadata and controls
150 lines (107 loc) · 4.88 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
override DEV_PATH=dev
override DOCKER_PATH=$(DEV_PATH)/docker
override SCRIPT_PATH=$(DEV_PATH)/scripts
override MAKEFILE_PATH=$(SCRIPT_PATH)/makefile
override DC_DEV=docker compose -f $(DOCKER_PATH)/docker-compose.dev.yml
override DC_TEST=docker compose -f $(DOCKER_PATH)/docker-compose.test.yml
override GO_VERSION=$(shell head -n 1 go.work)
override DOCKER_COMPOSE_FILE=$(DOCKER_PATH)/docker-compose.dev.yml
# Build images for different contexts
build-prod build-dev build-tests:
sed -i -e "1s/.*/$(GO_VERSION)/" $(DOCKER_PATH)/workspaces/*.work
bash $(MAKEFILE_PATH)/make-build-main.sh $@
build:
$(DOCKER_PATH)/build.sh
# Development
.SERVICE_TARGETS := auth autoupdate backend client datastore icc manage media proxy search vote
$(.SERVICE_TARGETS):
@echo ""
.FLAGS := no-cache capsule compose-local-branch
$(.FLAGS):
@echo ""
.PHONY: dev
dev dev-help dev-standalone dev-detached dev-attached dev-stop dev-exec dev-enter dev-clean dev-build dev-log:
@sed -i "1s/.*/$(GO_VERSION)/" $(DOCKER_PATH)/workspaces/*.work
@bash $(MAKEFILE_PATH)/make-dev.sh $@ "$(filter-out $@, $(MAKECMDGOALS))"
# Tests
run-tests:
bash dev/scripts/makefile/test-all-submodules.sh "$(filter-out $@, $(MAKECMDGOALS))"
test-ci:
bash $(SCRIPT_PATH)/act/run-act.sh $(FOLDER) $(WORKFLOW_TRIGGER)
# Make-release commands
services-to-main:
$(SCRIPT_PATH)/make-update.sh fetch-all-changes $(ARGS)
services-to-main-pull:
$(SCRIPT_PATH)/make-update.sh fetch-all-changes --pull $(ARGS)
staging-update:
$(SCRIPT_PATH)/make-update.sh staging $(ARGS)
staging-log:
$(SCRIPT_PATH)/make-update.sh staging-log
hotfix-update:
$(SCRIPT_PATH)/make-update.sh hotfix $(ARGS)
stable-update:
$(SCRIPT_PATH)/make-update.sh stable $(ARGS)
# Translation helper targets
extract-translations:
dev/scripts/extract-translations.sh
push-translations:
tx push --source
pull-translations:
tx pull --translations --languages $$(dev/scripts/dc-dev.sh exec client npm run get-available-languages | tail -n 1)
copy-translations:
cp i18n/*.po openslides-client/client/src/assets/i18n/
cp i18n/*.po openslides-backend/openslides_backend/i18n/messages/
########################## Deprecation List ##########################
deprecation-warning:
@echo "\033[1;33m DEPRECATION WARNING: This make command is deprecated and will be removed soon! \033[0m"
deprecation-warning-alternative: | deprecation-warning
@echo "\033[1;33m Please use the following command instead: $(ALTERNATIVE) \033[0m"
run-dev:
@make deprecation-warning-alternative ALTERNATIVE="dev"
sed -i "1s/.*/$(GO_VERSION)/" $(DOCKER_PATH)/workspaces/*.work
chmod +x $(SCRIPT_PATH)/makefile/build-all-submodules.sh
$(DC_DEV) up $(ARGS)
run-dev-detached:
@make deprecation-warning-alternative ALTERNATIVE="dev"
sed -i "1s/.*/$(GO_VERSION)/" $(DOCKER_PATH)/workspaces/*.work
chmod +x $(SCRIPT_PATH)/makefile/build-all-submodules.sh
$(DC_DEV) up $(ARGS) -d
stop-dev:
@make deprecation-warning-alternative ALTERNATIVE="dev-stop"
$(DC_DEV) down --volumes --remove-orphans
# Run the tests of all services
run-service-tests:
@make deprecation-warning-alternative ALTERNATIVE="run-tests"
chmod +x $(SCRIPT_PATH)/makefile/test-all-submodules.sh
$(SCRIPT_PATH)/makefile/test-all-submodules.sh
# Execute while run-dev is running: Switch to the test database to execute backend tests without
# interfering with your dev database
switch-to-test: | deprecation-warning
$(DC_DEV) stop postgres
$(DC_TEST) up -d postgres-test
$(DC_DEV) -f $(DOCKER_PATH)/docker-compose.backend.yml up -d backend
$(DC_DEV) restart datastore-writer datastore-reader autoupdate vote
# Execute while run-dev is running: Switch back to your dev database
switch-to-dev: | deprecation-warning
$(DC_TEST) stop postgres-test
$(DC_DEV) up -d postgres backend
$(DC_DEV) restart datastore-writer datastore-reader autoupdate vote
# Shorthand to directly enter a shell in the backend after switching the databases
run-backend: | deprecation-warning switch-to-test
$(DC_DEV) exec backend ./entrypoint.sh bash --rcfile .bashrc
# Stop all backend-related services so that the backend dev setup can start
stop-backend: | deprecation-warning
$(DC_DEV) stop backend datastore-reader datastore-writer auth vote postgres redis icc autoupdate search
# Restart all backend-related services
start-backend: | deprecation-warning
$(DC_DEV) up -d backend datastore-reader datastore-writer auth vote postgres redis icc autoupdate search
# Stop the dev server with OpenTelemetry
stop-dev-otel: | deprecation-warning
$(DC_DEV) -f $(DOCKER_PATH)/dc.otel.dev.yml down --volumes --remove-orphans
# Same as run-dev, but with OpenTelemetry
run-dev-otel: | deprecation-warning build-dev
$(DC_DEV) -f $(DOCKER_PATH)/dc.otel.dev.yml up $(ARGS)
# You may only use this one time after cloning this repository.
# Will set the upstream remote to "origin"
submodules-origin-to-upstream: | deprecation-warning
git submodule foreach -q --recursive 'git remote rename origin upstream'