-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
127 lines (103 loc) · 2.53 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
120
121
122
123
124
125
126
127
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
GCP_PROJECT = open-broadcast
DOCKER_TAG = ch-openbroadcast-next
PORT_BE = 8080
PORT_FE = 3000
GIT_SHORT_SHA = $(shell git rev-parse --short HEAD)
.PHONY: lint-be
lint-be:
poetry run isort obr_core/ --check
poetry run ./manage.py spectacular --file /dev/null --validate
poetry run ruff check obr_core/
poetry run black --check obr_core/
.PHONY: lint-fe
lint-fe:
yarn lint
.PHONY: format-be
format-be:
poetry run isort obr_core/
poetry run ruff check --fix-only obr_core/
poetry run black obr_core/
.PHONY: format-fe
format-fe:
yarn fix
.PHONY: lint
lint: lint-be lint-fe
.PHONY: format
format: format-be format-fe
.PHONY: test-be
test-be:
pytest -m "not e2e" -s obr_core/tests/
.PHONY: test-e2e
test-e2e:
pytest -m "e2e" -s obr_core/tests/
.PHONY: test-fe
test-fe:
yarn test:unit
.PHONY: test
test:
make test-be
make test-fe
make test-e2e
.PHONY: openapi-schema
openapi-schema:
mkdir -p schema
./manage.py spectacular --validate --fail-on-warn --format openapi-json --file schema.json
npx openapi -i schema.json -o obr_ui/typings/api/ --exportCore false --exportServices false --indent 2
rm -f schema.json
.PHONY: setup
setup:
poetry install
yarn install
.PHONY: clean
clean:
rm -Rf dist/*
rm -Rf build/*
.PHONY: build
build:
yarn build
cp -R obr_ui/assets/ build/assets/
./manage.py collectstatic --no-input
.PHONY: docker-build
docker-build:
docker build --build-arg GIT_SHORT_SHA=$(GIT_SHORT_SHA) -f ./docker/Dockerfile -t $(DOCKER_TAG):latest .
.PHONY: release
release:
poetry run semantic-release publish
.PHONY: deploy
deploy:
gcloud builds submit \
--project $(GCP_PROJECT) \
--config gcp/build-migrate-deploy.yaml \
--timeout=1200
.PHONY: update-settings
update-settings:
gcloud --project $(GCP_PROJECT) \
secrets versions add ch-openbroadcast-settings --data-file .env.live
.PHONY: show-settings
show-settings:
gcloud --project $(GCP_PROJECT) \
secrets versions access latest --secret=ch-openbroadcast-settings
.PHONY: translations
translations:
poetry run ./manage.py makemessages \
--no-wrap \
-l de \
-l fr \
-i 'obr_core/base/*' \
-i 'node_modules/*'
poetry run ./manage.py compilemessages
.PHONY: run-be
run-be:
./manage.py runserver 0.0.0.0:${PORT_BE}
.PHONY: run-fe
run-fe:
yarn serve --port ${PORT_FE}
.PHONY: run-hypercorn
run-hypercorn:
hypercorn config.asgi:application --bind :${PORT_BE} --access-logfile - --error-logfile - --reload