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