##// END OF EJS Templates
makefile: added helpers for code cleanups/builds
super-admin -
r1165:66dcd53d default
parent child Browse files
Show More
@@ -1,112 +1,120 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=vcsserver vcsserver
37 --cov=vcsserver vcsserver
38
38
39
39
40 .PHONY: ruff-check
41 ## run a ruff analysis
42 ruff-check:
43 ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev .
44
45
40 .PHONY: pip-packages
46 .PHONY: pip-packages
41 ## Show outdated packages
47 ## Show outdated packages
42 pip-packages:
48 pip-packages:
43 python ${OUTDATED_PACKAGES}
49 python ${OUTDATED_PACKAGES}
44
50
45
51
46 .PHONY: build
52 .PHONY: build
47 ## Build sdist/egg
53 ## Build sdist/egg
48 build:
54 build:
49 python -m build
55 python -m build
50
56
51
57
52 .PHONY: dev-env
58 .PHONY: dev-env
53 ## make dev-env based on the requirements files and install develop of packages
59 ## make dev-env based on the requirements files and install develop of packages
60 ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
54 dev-env:
61 dev-env:
55 pip install build virtualenv
62 pip install build virtualenv
56 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt
63 pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt
57 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt
64 pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt
58 pip install -e .
65 pip install -e .
59
66
60
67
61 .PHONY: dev-srv
68 .PHONY: dev-srv
62 ## run develop server instance
69 ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash
63 dev-srv:
70 dev-srv:
64 pserve --reload .dev/dev.ini
71 pserve --reload .dev/dev.ini
65
72
66
73
67 .PHONY: dev-srv-g
74 .PHONY: dev-srv-g
68 ## run gunicorn multi process workers
75 ## run gunicorn multi process workers
69 dev-srv-g:
76 dev-srv-g:
70 gunicorn --workers=4 --paste .dev/dev.ini --bind=0.0.0.0:10010 --config=.dev/gunicorn_config.py
77 gunicorn --workers=4 --paste .dev/dev.ini --bind=0.0.0.0:10010 --config=.dev/gunicorn_config.py
71
78
79
72 # Default command on calling make
80 # Default command on calling make
73 .DEFAULT_GOAL := show-help
81 .DEFAULT_GOAL := show-help
74
82
75 .PHONY: show-help
83 .PHONY: show-help
76 show-help:
84 show-help:
77 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
85 @echo "$$(tput bold)Available rules:$$(tput sgr0)"
78 @echo
86 @echo
79 @sed -n -e "/^## / { \
87 @sed -n -e "/^## / { \
80 h; \
88 h; \
81 s/.*//; \
89 s/.*//; \
82 :doc" \
90 :doc" \
83 -e "H; \
91 -e "H; \
84 n; \
92 n; \
85 s/^## //; \
93 s/^## //; \
86 t doc" \
94 t doc" \
87 -e "s/:.*//; \
95 -e "s/:.*//; \
88 G; \
96 G; \
89 s/\\n## /---/; \
97 s/\\n## /---/; \
90 s/\\n/ /g; \
98 s/\\n/ /g; \
91 p; \
99 p; \
92 }" ${MAKEFILE_LIST} \
100 }" ${MAKEFILE_LIST} \
93 | LC_ALL='C' sort --ignore-case \
101 | LC_ALL='C' sort --ignore-case \
94 | awk -F '---' \
102 | awk -F '---' \
95 -v ncol=$$(tput cols) \
103 -v ncol=$$(tput cols) \
96 -v indent=19 \
104 -v indent=19 \
97 -v col_on="$$(tput setaf 6)" \
105 -v col_on="$$(tput setaf 6)" \
98 -v col_off="$$(tput sgr0)" \
106 -v col_off="$$(tput sgr0)" \
99 '{ \
107 '{ \
100 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
108 printf "%s%*s%s ", col_on, -indent, $$1, col_off; \
101 n = split($$2, words, " "); \
109 n = split($$2, words, " "); \
102 line_length = ncol - indent; \
110 line_length = ncol - indent; \
103 for (i = 1; i <= n; i++) { \
111 for (i = 1; i <= n; i++) { \
104 line_length -= length(words[i]) + 1; \
112 line_length -= length(words[i]) + 1; \
105 if (line_length <= 0) { \
113 if (line_length <= 0) { \
106 line_length = ncol - indent - length(words[i]) - 1; \
114 line_length = ncol - indent - length(words[i]) - 1; \
107 printf "\n%*s ", -indent, " "; \
115 printf "\n%*s ", -indent, " "; \
108 } \
116 } \
109 printf "%s ", words[i]; \
117 printf "%s ", words[i]; \
110 } \
118 } \
111 printf "\n"; \
119 printf "\n"; \
112 }'
120 }'
General Comments 0
You need to be logged in to leave comments. Login now