Show More
@@ -1,191 +1,196 b'' | |||||
1 | # required for pushd to work.. |
|
1 | # required for pushd to work.. | |
2 | SHELL = /bin/bash |
|
2 | SHELL = /bin/bash | |
3 |
|
3 | |||
4 |
|
4 | |||
5 | # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py |
|
5 | # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py | |
6 | OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} |
|
6 | OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} | |
7 |
|
7 | |||
8 | .PHONY: clean |
|
8 | .PHONY: clean | |
9 | ## Cleanup compiled and cache py files |
|
9 | ## Cleanup compiled and cache py files | |
10 | clean: |
|
10 | clean: | |
11 | make test-clean |
|
11 | make test-clean | |
12 | find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' |
|
12 | find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' | |
13 | find . -type d -name "build" -prune -exec rm -rf '{}' ';' |
|
13 | find . -type d -name "build" -prune -exec rm -rf '{}' ';' | |
14 |
|
14 | |||
15 |
|
15 | |||
16 | .PHONY: test |
|
16 | .PHONY: test | |
17 | ## run test-clean and tests |
|
17 | ## run test-clean and tests | |
18 | test: |
|
18 | test: | |
19 | make test-clean |
|
19 | make test-clean | |
20 | make test-only |
|
20 | make test-only | |
21 |
|
21 | |||
22 |
|
22 | |||
23 | .PHONY: test-clean |
|
23 | .PHONY: test-clean | |
24 | ## run test-clean and tests |
|
24 | ## run test-clean and tests | |
25 | test-clean: |
|
25 | test-clean: | |
26 | rm -rf coverage.xml htmlcov junit.xml pylint.log result |
|
26 | rm -rf coverage.xml htmlcov junit.xml pylint.log result | |
27 | find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' |
|
27 | find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' | |
28 | find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' |
|
28 | find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' | |
29 |
|
29 | |||
30 |
|
30 | |||
31 | .PHONY: test-only |
|
31 | .PHONY: test-only | |
32 | ## Run tests only without cleanup |
|
32 | ## Run tests only without cleanup | |
33 | test-only: |
|
33 | test-only: | |
34 | PYTHONHASHSEED=random \ |
|
34 | PYTHONHASHSEED=random \ | |
35 | py.test -x -vv -r xw -p no:sugar \ |
|
35 | py.test -x -vv -r xw -p no:sugar \ | |
36 | --cov-report=term-missing --cov-report=html \ |
|
36 | --cov-report=term-missing --cov-report=html \ | |
37 | --cov=rhodecode rhodecode |
|
37 | --cov=rhodecode rhodecode | |
38 |
|
38 | |||
39 |
|
39 | |||
40 | .PHONY: test-only-mysql |
|
40 | .PHONY: test-only-mysql | |
41 | ## run tests against mysql |
|
41 | ## run tests against mysql | |
42 | test-only-mysql: |
|
42 | test-only-mysql: | |
43 | PYTHONHASHSEED=random \ |
|
43 | PYTHONHASHSEED=random \ | |
44 | py.test -x -vv -r xw -p no:sugar \ |
|
44 | py.test -x -vv -r xw -p no:sugar \ | |
45 | --cov-report=term-missing --cov-report=html \ |
|
45 | --cov-report=term-missing --cov-report=html \ | |
46 | --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \ |
|
46 | --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \ | |
47 | --cov=rhodecode rhodecode |
|
47 | --cov=rhodecode rhodecode | |
48 |
|
48 | |||
49 |
|
49 | |||
50 | .PHONY: test-only-postgres |
|
50 | .PHONY: test-only-postgres | |
51 | ## run tests against postgres |
|
51 | ## run tests against postgres | |
52 | test-only-postgres: |
|
52 | test-only-postgres: | |
53 | PYTHONHASHSEED=random \ |
|
53 | PYTHONHASHSEED=random \ | |
54 | py.test -x -vv -r xw -p no:sugar \ |
|
54 | py.test -x -vv -r xw -p no:sugar \ | |
55 | --cov-report=term-missing --cov-report=html \ |
|
55 | --cov-report=term-missing --cov-report=html \ | |
56 | --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \ |
|
56 | --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \ | |
57 | --cov=rhodecode rhodecode |
|
57 | --cov=rhodecode rhodecode | |
58 |
|
58 | |||
59 | .PHONY: ruff-check |
|
59 | .PHONY: ruff-check | |
60 | ## run a ruff analysis |
|
60 | ## run a ruff analysis | |
61 | ruff-check: |
|
61 | ruff-check: | |
62 | ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev . |
|
62 | ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev . | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | .PHONY: docs |
|
65 | .PHONY: docs | |
66 | ## build docs |
|
66 | ## build docs | |
67 | docs: |
|
67 | docs: | |
68 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html) |
|
68 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html) | |
69 |
|
69 | |||
70 |
|
70 | |||
71 | .PHONY: docs-clean |
|
71 | .PHONY: docs-clean | |
72 | ## Cleanup docs |
|
72 | ## Cleanup docs | |
73 | docs-clean: |
|
73 | docs-clean: | |
74 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean) |
|
74 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean) | |
75 |
|
75 | |||
76 |
|
76 | |||
77 | .PHONY: docs-cleanup |
|
77 | .PHONY: docs-cleanup | |
78 | ## Cleanup docs |
|
78 | ## Cleanup docs | |
79 | docs-cleanup: |
|
79 | docs-cleanup: | |
80 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup) |
|
80 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup) | |
81 |
|
81 | |||
82 |
|
82 | |||
83 | .PHONY: web-build |
|
83 | .PHONY: web-build | |
84 | ## Build JS packages static/js |
|
84 | ## Build JS packages static/js | |
85 | web-build: |
|
85 | web-build: | |
86 | docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt" |
|
86 | docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt" | |
87 | # run static file check |
|
87 | # run static file check | |
88 | ./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/ |
|
88 | ./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/ | |
89 | rm -rf node_modules |
|
89 | rm -rf node_modules | |
90 |
|
90 | |||
|
91 | .PHONY: ruff-check | |||
|
92 | ## run a ruff analysis | |||
|
93 | ruff-check: | |||
|
94 | ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev . | |||
91 |
|
95 | |||
92 | .PHONY: pip-packages |
|
96 | .PHONY: pip-packages | |
93 | ## Show outdated packages |
|
97 | ## Show outdated packages | |
94 | pip-packages: |
|
98 | pip-packages: | |
95 | python ${OUTDATED_PACKAGES} |
|
99 | python ${OUTDATED_PACKAGES} | |
96 |
|
100 | |||
97 |
|
101 | |||
98 | .PHONY: build |
|
102 | .PHONY: build | |
99 | ## Build sdist/egg |
|
103 | ## Build sdist/egg | |
100 | build: |
|
104 | build: | |
101 | python -m build |
|
105 | python -m build | |
102 |
|
106 | |||
103 |
|
107 | |||
104 | .PHONY: dev-sh |
|
108 | .PHONY: dev-sh | |
105 | ## make dev-sh |
|
109 | ## make dev-sh | |
106 | dev-sh: |
|
110 | dev-sh: | |
107 | sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list" |
|
111 | sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list" | |
108 | sudo apt-get update |
|
112 | sudo apt-get update | |
109 | sudo apt-get install -y zsh carapace-bin |
|
113 | sudo apt-get install -y zsh carapace-bin | |
110 | rm -rf /home/rhodecode/.oh-my-zsh |
|
114 | rm -rf /home/rhodecode/.oh-my-zsh | |
111 | curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh |
|
115 | curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh | |
112 | @echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc |
|
116 | @echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc | |
113 | @echo "${RC_DEV_CMD_HELP}" |
|
117 | @echo "${RC_DEV_CMD_HELP}" | |
114 | @PROMPT='%(?.%F{green}β.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh |
|
118 | @PROMPT='%(?.%F{green}β.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh | |
115 |
|
119 | |||
116 |
|
120 | |||
117 | .PHONY: dev-cleanup |
|
121 | .PHONY: dev-cleanup | |
118 | ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y |
|
122 | ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y | |
119 | dev-cleanup: |
|
123 | dev-cleanup: | |
120 | pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y |
|
124 | pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y | |
121 | rm -rf /tmp/* |
|
125 | rm -rf /tmp/* | |
122 |
|
126 | |||
123 |
|
127 | |||
124 | .PHONY: dev-env |
|
128 | .PHONY: dev-env | |
125 | ## make dev-env based on the requirements files and install develop of packages |
|
129 | ## make dev-env based on the requirements files and install develop of packages | |
|
130 | ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y | |||
126 | dev-env: |
|
131 | dev-env: | |
127 | sudo -u root chown rhodecode:rhodecode /home/rhodecode/.cache/pip/ |
|
132 | sudo -u root chown rhodecode:rhodecode /home/rhodecode/.cache/pip/ | |
128 | pip install build virtualenv |
|
133 | pip install build virtualenv | |
129 | pushd ../rhodecode-vcsserver/ && make dev-env && popd |
|
134 | pushd ../rhodecode-vcsserver/ && make dev-env && popd | |
130 | pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt |
|
135 | pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt | |
131 | pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt |
|
136 | pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_rc_tools.txt -r requirements_test.txt -r requirements_debug.txt | |
132 | pip install -e . |
|
137 | pip install -e . | |
133 |
|
138 | |||
134 |
|
139 | |||
135 | .PHONY: sh |
|
140 | .PHONY: sh | |
136 | ## shortcut for make dev-sh dev-env |
|
141 | ## shortcut for make dev-sh dev-env | |
137 | sh: |
|
142 | sh: | |
138 | make dev-env |
|
143 | make dev-env | |
139 | make dev-sh |
|
144 | make dev-sh | |
140 |
|
145 | |||
141 |
|
146 | |||
142 | ## Allows changes of workers e.g make dev-srv-g workers=2 |
|
147 | ## Allows changes of workers e.g make dev-srv-g workers=2 | |
143 | workers?=1 |
|
148 | workers?=1 | |
144 |
|
149 | |||
145 | .PHONY: dev-srv |
|
150 | .PHONY: dev-srv | |
146 | ## run gunicorn multi process workers |
|
151 | ## run gunicorn web server with reloader, use workers=N to set multiworker mode | |
147 |
dev-srv |
|
152 | dev-srv: | |
148 | gunicorn --paste=.dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload --workers=$(workers) |
|
153 | gunicorn --paste=.dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload --workers=$(workers) | |
149 |
|
154 | |||
150 |
|
155 | |||
151 | # Default command on calling make |
|
156 | # Default command on calling make | |
152 | .DEFAULT_GOAL := show-help |
|
157 | .DEFAULT_GOAL := show-help | |
153 |
|
158 | |||
154 | .PHONY: show-help |
|
159 | .PHONY: show-help | |
155 | show-help: |
|
160 | show-help: | |
156 | @echo "$$(tput bold)Available rules:$$(tput sgr0)" |
|
161 | @echo "$$(tput bold)Available rules:$$(tput sgr0)" | |
157 | @echo |
|
162 | @echo | |
158 | @sed -n -e "/^## / { \ |
|
163 | @sed -n -e "/^## / { \ | |
159 | h; \ |
|
164 | h; \ | |
160 | s/.*//; \ |
|
165 | s/.*//; \ | |
161 | :doc" \ |
|
166 | :doc" \ | |
162 | -e "H; \ |
|
167 | -e "H; \ | |
163 | n; \ |
|
168 | n; \ | |
164 | s/^## //; \ |
|
169 | s/^## //; \ | |
165 | t doc" \ |
|
170 | t doc" \ | |
166 | -e "s/:.*//; \ |
|
171 | -e "s/:.*//; \ | |
167 | G; \ |
|
172 | G; \ | |
168 | s/\\n## /---/; \ |
|
173 | s/\\n## /---/; \ | |
169 | s/\\n/ /g; \ |
|
174 | s/\\n/ /g; \ | |
170 | p; \ |
|
175 | p; \ | |
171 | }" ${MAKEFILE_LIST} \ |
|
176 | }" ${MAKEFILE_LIST} \ | |
172 | | LC_ALL='C' sort --ignore-case \ |
|
177 | | LC_ALL='C' sort --ignore-case \ | |
173 | | awk -F '---' \ |
|
178 | | awk -F '---' \ | |
174 | -v ncol=$$(tput cols) \ |
|
179 | -v ncol=$$(tput cols) \ | |
175 | -v indent=19 \ |
|
180 | -v indent=19 \ | |
176 | -v col_on="$$(tput setaf 6)" \ |
|
181 | -v col_on="$$(tput setaf 6)" \ | |
177 | -v col_off="$$(tput sgr0)" \ |
|
182 | -v col_off="$$(tput sgr0)" \ | |
178 | '{ \ |
|
183 | '{ \ | |
179 | printf "%s%*s%s ", col_on, -indent, $$1, col_off; \ |
|
184 | printf "%s%*s%s ", col_on, -indent, $$1, col_off; \ | |
180 | n = split($$2, words, " "); \ |
|
185 | n = split($$2, words, " "); \ | |
181 | line_length = ncol - indent; \ |
|
186 | line_length = ncol - indent; \ | |
182 | for (i = 1; i <= n; i++) { \ |
|
187 | for (i = 1; i <= n; i++) { \ | |
183 | line_length -= length(words[i]) + 1; \ |
|
188 | line_length -= length(words[i]) + 1; \ | |
184 | if (line_length <= 0) { \ |
|
189 | if (line_length <= 0) { \ | |
185 | line_length = ncol - indent - length(words[i]) - 1; \ |
|
190 | line_length = ncol - indent - length(words[i]) - 1; \ | |
186 | printf "\n%*s ", -indent, " "; \ |
|
191 | printf "\n%*s ", -indent, " "; \ | |
187 | } \ |
|
192 | } \ | |
188 | printf "%s ", words[i]; \ |
|
193 | printf "%s ", words[i]; \ | |
189 | } \ |
|
194 | } \ | |
190 | printf "\n"; \ |
|
195 | printf "\n"; \ | |
191 | }' |
|
196 | }' |
General Comments 0
You need to be logged in to leave comments.
Login now