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