-
Notifications
You must be signed in to change notification settings - Fork 555
Expand file tree
/
Copy pathMakefile-docker
More file actions
179 lines (142 loc) Β· 4.15 KB
/
Copy pathMakefile-docker
File metadata and controls
179 lines (142 loc) Β· 4.15 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
export PYTHON_COMMAND=python3
# As we're using user-local installs inside the docker-container we need
# to be cautious about uprading pip and not confusing it with the
# globally installed version. This will take `$PYTHONUSERBASE` and `$PIP_USER`
# into account.
# See https://github.com/pypa/pip/issues/7205
export PIP_COMMAND=$(PYTHON_COMMAND) -m pip
APP=src/olympia/
# Build list of dependencies to install
DEPS = pip prod
# If we're running a development image, then we should install the development dependencies
ifeq ($(OLYMPIA_DEPS), development)
DEPS += dev
endif
.PHONY: help_redirect
help_redirect:
@$(MAKE) help --no-print-directory
.PHONY: check_debian_packages
check_debian_packages: ## check the existence of multiple debian packages
./scripts/check_debian_packages.sh
.PHONY: check_pip_packages
check_pip_packages: ## check the existence of multiple python packages
@for dep in $(DEPS); do \
./scripts/check_pip_packages.sh $$dep.txt; \
done
.PHONY: check_django
check_django: ## check if the django app is configured properly
./manage.py check
.PHONY: check
check: check_debian_packages check_pip_packages check_django
.PHONY: data_dump
data_dump:
./manage.py data_dump $(ARGS)
.PHONY: data_load
data_load:
./manage.py data_load $(ARGS)
.PHONY: update_assets
update_assets: ## Update the static assets
$(HOME)/scripts/update_assets.py
.PHONY: run_vite
run_vite:
npm run $(NPM_ARGS) dev
.PHONY: update_deps
update_deps: ## Update the dependencies
$(HOME)/scripts/install_deps.py $(DEPS)
# TOOD: remove this after we migrate addons-frontned to not depend on it.
.PHONY: setup-ui-tests
setup-ui-tests:
@echo "This is a deprecated target, please stop using it."
.PHONY: lint
lint: ## lint the code
ruff check .
ruff format --check .
npm run check
curlylint src/ --quiet
lint-codestyle: lint
.PHONY: docs_pre_build
docs_pre_build:
./manage.py generate_model_diagrams
.PHONY: docs
docs: docs_pre_build ## build the documentation
$(MAKE) -C docs html SPHINXOPTS='-nW'
.PHONY: djshell
djshell: ## connect to django shell
$(PYTHON_COMMAND) ./manage.py shell_plus
.PHONY: dbshell
dbshell: ## connect to a database shell
$(PYTHON_COMMAND) ./manage.py dbshell
.PHONY: initialize
initialize: ## ensure database exists
@echo "Initializing data..."
@echo "args: $(ARGS)"
$(PYTHON_COMMAND) ./manage.py initialize $(ARGS)
PYTEST_SRC := src/olympia/
.PHONY: test_js
test_js:
npm run test tests/js
.PHONY: test_main
test_main:
pytest $(PYTEST_SRC) \
-n auto \
-m 'not requires_elasticsearch and not requires_autograph' \
$(ARGS)
.PHONY: test_requires_elasticsearch_tests
test_requires_elasticsearch_tests:
pytest \
$(PYTEST_SRC) \
-m 'requires_elasticsearch' \
$(ARGS)
.PHONY: test_requires_autograph_tests
test_requires_autograph_tests:
pytest \
$(PYTEST_SRC) \
-m 'requires_autograph' \
$(ARGS)
.PHONY: test
test: ## run the entire test suite
pytest \
$(PYTEST_SRC) \
$(ARGS)
.PHONY: test_force_db
test_force_db: ## run the entire test suite with a new database
pytest \
$(PYTEST_SRC) \
--create-db \
$(ARGS)
.PHONY: tdd
tdd: ## run the entire test suite, but stop on the first error
pytest \
$(PYTEST_SRC) \
-x --pdb \
$(ARGS)
.PHONY: test_failed
test_failed: ## rerun the failed tests from the previous run
pytest \
$(PYTEST_SRC) \
--lf \
$(ARGS)
.PHONY: watch_js_tests
watch_js_tests: ## Run+watch the JavaScript test suite (requires compiled/compressed assets).
npm run test:watch
.PHONY: format_js
format_js: ## Autoformat our js and css files
npm run fix
.PHONY: format_py
format_py: ## Autoformat our python files.
ruff check --fix-only .
ruff format .
.PHONY: ruff
ruff: format_py
.PHONY: format
format: format_py format_js ## Autoformat our codebase.
.PHONY: extract_locales
extract_locales: ## extracts and merges translation strings
./scripts/run_l10n_extraction.sh
.PHONE: compile_locales
compile_locales: ## compiles translation strings
$(PIP_COMMAND) install --progress-bar=off --no-deps -r requirements/locale.txt
$(HOME)/scripts/compile_locales.py
.PHONY: help_submake
help_submake:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' Makefile-docker | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'