Show More
@@ -1,158 +1,169 b'' | |||
|
1 | 1 | .DEFAULT_GOAL := help |
|
2 | 2 | |
|
3 | 3 | # Pretty print values cf. https://misc.flogisoft.com/bash/tip_colors_and_formatting |
|
4 | 4 | RESET := \033[0m # Reset all formatting |
|
5 | 5 | GREEN := \033[0;32m # Resets before setting 16b colour (32 -- green) |
|
6 | 6 | YELLOW := \033[0;33m |
|
7 | 7 | ORANGE := \033[0;38;5;208m # Reset then set 256b colour (208 -- orange) |
|
8 | 8 | PEACH := \033[0;38;5;216m |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | ## ---------------------------------------------------------------------------------- ## |
|
12 | 12 | ## ------------------------- Help usage builder ------------------------------------- ## |
|
13 | 13 | ## ---------------------------------------------------------------------------------- ## |
|
14 | 14 | # use '# >>> Build commands' to create section |
|
15 | 15 | # use '# target: target description' to create help for target |
|
16 | 16 | .PHONY: help |
|
17 | 17 | help: |
|
18 | 18 | @echo "Usage:" |
|
19 | 19 | @cat $(MAKEFILE_LIST) | grep -E '^# >>>|^# [A-Za-z0-9_.-]+:' | sed -E 's/^# //' | awk ' \ |
|
20 | 20 | BEGIN { \ |
|
21 | 21 | green="\033[32m"; \ |
|
22 | 22 | yellow="\033[33m"; \ |
|
23 | 23 | reset="\033[0m"; \ |
|
24 | 24 | section=""; \ |
|
25 | 25 | } \ |
|
26 | 26 | /^>>>/ { \ |
|
27 | 27 | section=substr($$0, 5); \ |
|
28 | 28 | printf "\n" green ">>> %s" reset "\n", section; \ |
|
29 | 29 | next; \ |
|
30 | 30 | } \ |
|
31 | 31 | /^([A-Za-z0-9_.-]+):/ { \ |
|
32 | 32 | target=$$1; \ |
|
33 | 33 | gsub(/:$$/, "", target); \ |
|
34 | 34 | description=substr($$0, index($$0, ":") + 2); \ |
|
35 | 35 | if (description == "") { description="-"; } \ |
|
36 | 36 | printf " - " yellow "%-35s" reset " %s\n", target, description; \ |
|
37 | 37 | } \ |
|
38 | 38 | ' |
|
39 | 39 | |
|
40 | 40 | # required for pushd to work.. |
|
41 | 41 | SHELL = /bin/bash |
|
42 | 42 | |
|
43 | 43 | # >>> Tests commands |
|
44 | 44 | |
|
45 | 45 | .PHONY: clean |
|
46 | 46 | # clean: Cleanup compiled and cache py files |
|
47 | 47 | clean: |
|
48 | 48 | make test-clean |
|
49 | 49 | find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' |
|
50 | 50 | find . -type d -name "build" -prune -exec rm -rf '{}' ';' |
|
51 | 51 | |
|
52 | 52 | |
|
53 | 53 | .PHONY: test |
|
54 | 54 | # test: run test-clean and tests |
|
55 | 55 | test: |
|
56 | 56 | make test-clean |
|
57 | unset RC_SQLALCHEMY_DB1_URL && unset RC_DB_URL && make test-only | |
|
57 | make test-only | |
|
58 | 58 | |
|
59 | 59 | |
|
60 | 60 | .PHONY: test-clean |
|
61 | 61 | # test-clean: run test-clean and tests |
|
62 | 62 | test-clean: |
|
63 | 63 | rm -rf coverage.xml htmlcov junit.xml pylint.log result |
|
64 | 64 | find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' |
|
65 | 65 | find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' |
|
66 | 66 | |
|
67 | 67 | |
|
68 | 68 | .PHONY: test-only |
|
69 | 69 | # test-only: Run tests only without cleanup |
|
70 | 70 | test-only: |
|
71 | 71 | PYTHONHASHSEED=random \ |
|
72 | 72 | py.test -x -vv -r xw -p no:sugar \ |
|
73 | 73 | --cov-report=term-missing --cov-report=html \ |
|
74 | --cov=rhodecode rhodecode | |
|
74 | --cov=rhodecode rhodecode \ | |
|
75 | --ignore=rhodecode/tests/vcs_operations \ | |
|
76 | --ignore=rhodecode/tests/database | |
|
77 | ||
|
78 | PYTHONHASHSEED=random \ | |
|
79 | py.test -x -vv -r xw -p no:sugar \ | |
|
80 | rhodecode/tests/vcs_operations | |
|
81 | ||
|
82 | PYTHONHASHSEED=random \ | |
|
83 | py.test -x -vv -r xw -p no:sugar \ | |
|
84 | rhodecode/tests/database | |
|
85 | ||
|
75 | 86 | |
|
76 | 87 | # >>> Docs commands |
|
77 | 88 | |
|
78 | 89 | .PHONY: docs |
|
79 | 90 | # docs: build docs |
|
80 | 91 | docs: |
|
81 | 92 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html) |
|
82 | 93 | |
|
83 | 94 | |
|
84 | 95 | .PHONY: docs-clean |
|
85 | 96 | # docs-clean: Cleanup docs |
|
86 | 97 | docs-clean: |
|
87 | 98 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean) |
|
88 | 99 | |
|
89 | 100 | |
|
90 | 101 | .PHONY: docs-cleanup |
|
91 | 102 | # docs-cleanup: Cleanup docs |
|
92 | 103 | docs-cleanup: |
|
93 | 104 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup) |
|
94 | 105 | |
|
95 | 106 | # >>> Dev commands |
|
96 | 107 | |
|
97 | 108 | .PHONY: web-build |
|
98 | 109 | # web-build: Build JS packages static/js |
|
99 | 110 | web-build: |
|
100 | 111 | rm -rf node_modules |
|
101 | 112 | docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt" |
|
102 | 113 | # run static file check |
|
103 | 114 | ./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/ |
|
104 | 115 | rm -rf node_modules |
|
105 | 116 | |
|
106 | 117 | |
|
107 | 118 | .PHONY: dev-sh |
|
108 | 119 | # dev-sh: make dev-sh |
|
109 | 120 | dev-sh: |
|
110 | 121 | sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list" |
|
111 | 122 | sudo apt-get update |
|
112 | 123 | sudo apt-get install -y zsh carapace-bin |
|
113 | 124 | rm -rf /home/rhodecode/.oh-my-zsh |
|
114 | 125 | curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh |
|
115 | 126 | @echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc |
|
116 | 127 | @echo "${RC_DEV_CMD_HELP}" |
|
117 | 128 | @PROMPT='%(?.%F{green}β.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh |
|
118 | 129 | |
|
119 | 130 | |
|
120 | 131 | .PHONY: dev-cleanup |
|
121 | 132 | # dev-cleanup: Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y |
|
122 | 133 | dev-cleanup: |
|
123 | 134 | pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y |
|
124 | 135 | rm -rf /tmp/* |
|
125 | 136 | |
|
126 | 137 | |
|
127 | 138 | .PHONY: dev-env |
|
128 | 139 | # dev-env: make dev-env based on the requirements files and install develop of packages |
|
129 | 140 | ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y |
|
130 | 141 | dev-env: |
|
131 | 142 | sudo -u root chown rhodecode:rhodecode /home/rhodecode/.cache/pip/ |
|
132 | 143 | pip install build virtualenv |
|
133 | 144 | pushd ../rhodecode-vcsserver/ && make dev-env && popd |
|
134 | 145 | 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 | 146 | 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 | 147 | pip install -e . |
|
137 | 148 | |
|
138 | 149 | |
|
139 | 150 | .PHONY: sh |
|
140 | 151 | # sh: shortcut for make dev-sh dev-env |
|
141 | 152 | sh: |
|
142 | 153 | make dev-env |
|
143 | 154 | make dev-sh |
|
144 | 155 | |
|
145 | 156 | |
|
146 | 157 | ## Allows changes of workers e.g make dev-srv-g workers=2 |
|
147 | 158 | workers?=1 |
|
148 | 159 | |
|
149 | 160 | .PHONY: dev-srv |
|
150 | 161 | # dev-srv: run gunicorn web server with reloader, use workers=N to set multiworker mode, workers=N allows changes of workers |
|
151 | 162 | dev-srv: |
|
152 | 163 | gunicorn --paste=.dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload --workers=$(workers) |
|
153 | 164 | |
|
154 | 165 | .PHONY: ruff-check |
|
155 | 166 | # ruff-check: run a ruff analysis |
|
156 | 167 | ruff-check: |
|
157 | 168 | ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev . |
|
158 | 169 |
General Comments 0
You need to be logged in to leave comments.
Login now