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