##// END OF EJS Templates
makefile: added some helpers
super-admin -
r5181:98dea20a default
parent child Browse files
Show More
@@ -1,178 +1,181 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 .PHONY: test
20 .PHONY: test
20 ## run test-clean and tests
21 ## run test-clean and tests
21 test:
22 test:
22 make test-clean
23 make test-clean
23 make test-only
24 make test-only
24
25
25
26
26 .PHONY: test-clean
27 .PHONY: test-clean
27 ## run test-clean and tests
28 ## run test-clean and tests
28 test-clean:
29 test-clean:
29 rm -rf coverage.xml htmlcov junit.xml pylint.log result
30 rm -rf coverage.xml htmlcov junit.xml pylint.log result
30 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
31 find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';'
31 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
32 find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';'
32
33
33
34
34 .PHONY: test-only
35 .PHONY: test-only
35 ## Run tests only without cleanup
36 ## Run tests only without cleanup
36 test-only:
37 test-only:
37 PYTHONHASHSEED=random \
38 PYTHONHASHSEED=random \
38 py.test -x -vv -r xw -p no:sugar \
39 py.test -x -vv -r xw -p no:sugar \
39 --cov-report=term-missing --cov-report=html \
40 --cov-report=term-missing --cov-report=html \
40 --cov=rhodecode rhodecode
41 --cov=rhodecode rhodecode
41
42
42
43
43 .PHONY: test-only-mysql
44 .PHONY: test-only-mysql
44 ## run tests against mysql
45 ## run tests against mysql
45 test-only-mysql:
46 test-only-mysql:
46 PYTHONHASHSEED=random \
47 PYTHONHASHSEED=random \
47 py.test -x -vv -r xw -p no:sugar \
48 py.test -x -vv -r xw -p no:sugar \
48 --cov-report=term-missing --cov-report=html \
49 --cov-report=term-missing --cov-report=html \
49 --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"}}' \
50 --cov=rhodecode rhodecode
51 --cov=rhodecode rhodecode
51
52
52
53
53 .PHONY: test-only-postgres
54 .PHONY: test-only-postgres
54 ## run tests against postgres
55 ## run tests against postgres
55 test-only-postgres:
56 test-only-postgres:
56 PYTHONHASHSEED=random \
57 PYTHONHASHSEED=random \
57 py.test -x -vv -r xw -p no:sugar \
58 py.test -x -vv -r xw -p no:sugar \
58 --cov-report=term-missing --cov-report=html \
59 --cov-report=term-missing --cov-report=html \
59 --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"}}' \
60 --cov=rhodecode rhodecode
61 --cov=rhodecode rhodecode
61
62
62 .PHONY: ruff-check
63 .PHONY: ruff-check
63 ## run a ruff analysis
64 ## run a ruff analysis
64 ruff-check:
65 ruff-check:
65 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 .
66
67
67
68
68 .PHONY: docs
69 .PHONY: docs
69 ## build docs
70 ## build docs
70 docs:
71 docs:
71 (cd docs; nix-build default.nix -o result; make clean html)
72 (cd docs; nix-build default.nix -o result; make clean html)
72
73
73
74
74 .PHONY: docs-clean
75 .PHONY: docs-clean
75 ## Cleanup docs
76 ## Cleanup docs
76 docs-clean:
77 docs-clean:
77 (cd docs; make clean)
78 (cd docs; make clean)
78
79
79
80
80 .PHONY: docs-cleanup
81 .PHONY: docs-cleanup
81 ## Cleanup docs
82 ## Cleanup docs
82 docs-cleanup:
83 docs-cleanup:
83 (cd docs; make cleanup)
84 (cd docs; make cleanup)
84
85
85
86
86 .PHONY: web-build
87 .PHONY: web-build
87 ## Build JS packages static/js
88 ## Build JS packages static/js
88 # https://hub.docker.com/r/huli/grunt
89 # https://hub.docker.com/r/huli/grunt
89 web-build:
90 web-build:
90 NODE_PATH=$(NODE_PATH) $(GRUNT)
91 NODE_PATH=$(NODE_PATH) $(GRUNT)
91
92
92 # check required files
93 # check required files
93 STATIC_CHECK="/robots.txt /502.html \
94 STATIC_CHECK="/robots.txt /502.html \
94 /js/scripts.min.js /js/rhodecode-components.js \
95 /js/scripts.min.js /js/rhodecode-components.js \
95 /css/style.css /css/style-polymer.css /css/style-ipython.css"
96 /css/style.css /css/style-polymer.css /css/style-ipython.css"
96
97
97 for file in $STATIC_CHECK;
98 for file in $STATIC_CHECK;
98 do
99 do
99 if [ ! -f rhodecode/public/$file ]; then
100 if [ ! -f rhodecode/public/$file ]; then
100 echo "Missing $file expected after web-build"
101 echo "Missing $file expected after web-build"
101 exit 1
102 exit 1
102 fi
103 fi
103 done
104 done
104
105
105 .PHONY: pip-packages
106 .PHONY: pip-packages
106 ## Show outdated packages
107 ## Show outdated packages
107 pip-packages:
108 pip-packages:
108 python ${OUTDATED_PACKAGES}
109 python ${OUTDATED_PACKAGES}
109
110
110
111
111 .PHONY: build
112 .PHONY: build
112 ## Build sdist/egg
113 ## Build sdist/egg
113 build:
114 build:
114 python -m build
115 python -m build
115
116
116
117
117 .PHONY: dev-env
118 .PHONY: dev-env
118 ## make dev-env based on the requirements files and install develop of packages
119 ## make dev-env based on the requirements files and install develop of packages
120 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
119 dev-env:
121 dev-env:
120 pip install build virtualenv
122 pip install build virtualenv
121 pushd ../rhodecode-vcsserver/ && make dev-env && popd
123 pushd ../rhodecode-vcsserver/ && make dev-env && popd
122 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
124 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
123 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
125 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
124 pip install -e .
126 pip install -e .
125
127
126
128
127 .PHONY: dev-srv
129 .PHONY: dev-srv
128 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
130 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
129 dev-srv:
131 dev-srv:
130 pserve --reload .dev/dev.ini
132 pserve --reload .dev/dev.ini
131
133
134
132 .PHONY: dev-srv-g
135 .PHONY: dev-srv-g
133 ## run gunicorn multi process workers
136 ## run gunicorn multi process workers
134 dev-srv-g:
137 dev-srv-g:
135 gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py
138 gunicorn --workers=2 --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py
136
139
137
140
138 # Default command on calling make
141 # Default command on calling make
139 .DEFAULT_GOAL := show-help
142 .DEFAULT_GOAL := show-help
140
143
141 .PHONY: show-help
144 .PHONY: show-help
142 show-help:
145 show-help:
143 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
146 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
144 @echo
147 @echo
145 @sed -n -e "/^## / { \
148 @sed -n -e "/^## / { \
146 h; \
149 h; \
147 s/.*//; \
150 s/.*//; \
148 :doc" \
151 :doc" \
149 -e "H; \
152 -e "H; \
150 n; \
153 n; \
151 s/^## //; \
154 s/^## //; \
152 t doc" \
155 t doc" \
153 -e "s/:.*//; \
156 -e "s/:.*//; \
154 G; \
157 G; \
155 s/\\n## /---/; \
158 s/\\n## /---/; \
156 s/\\n/ /g; \
159 s/\\n/ /g; \
157 p; \
160 p; \
158 }" ${MAKEFILE_LIST} \
161 }" ${MAKEFILE_LIST} \
159 | LC_ALL='C' sort --ignore-case \
162 | LC_ALL='C' sort --ignore-case \
160 | awk -F '---' \
163 | awk -F '---' \
161 -v ncol=$$(tput cols) \
164 -v ncol=$$(tput cols) \
162 -v indent=19 \
165 -v indent=19 \
163 -v col_on="$$(tput setaf 6)" \
166 -v col_on="$$(tput setaf 6)" \
164 -v col_off="$$(tput sgr0)" \
167 -v col_off="$$(tput sgr0)" \
165 '{ \
168 '{ \
166 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
169 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
167 n = split($$2, words, " "); \
170 n = split($$2, words, " "); \
168 line_length = ncol - indent; \
171 line_length = ncol - indent; \
169 for (i = 1; i <= n; i++) { \
172 for (i = 1; i <= n; i++) { \
170 line_length -= length(words[i]) + 1; \
173 line_length -= length(words[i]) + 1; \
171 if (line_length <= 0) { \
174 if (line_length <= 0) { \
172 line_length = ncol - indent - length(words[i]) - 1; \
175 line_length = ncol - indent - length(words[i]) - 1; \
173 printf "\n%*s ", -indent, " "; \
176 printf "\n%*s ", -indent, " "; \
174 } \
177 } \
175 printf "%s ", words[i]; \
178 printf "%s ", words[i]; \
176 } \
179 } \
177 printf "\n"; \
180 printf "\n"; \
178 }'
181 }'
General Comments 0
You need to be logged in to leave comments. Login now