Makefile
137 lines
| 3.4 KiB
| text/x-makefile
|
MakefileLexer
r1116 | # required for pushd to work.. | |||
r1172 | SHELL = /bin/bash | |||
r132 | ||||
r1116 | ||||
r832 | # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py | |||
OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} | ||||
r132 | ||||
r912 | .PHONY: clean | |||
r1040 | ## Cleanup compiled and cache py files | |||
r132 | clean: | |||
make test-clean | ||||
r642 | find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' | |||
r1134 | find . -type d -name "build" -prune -exec rm -rf '{}' ';' | |||
r132 | ||||
r912 | ||||
.PHONY: test | ||||
r1053 | ## run test-clean and tests | |||
r132 | test: | |||
make test-clean | ||||
make test-only | ||||
r912 | ||||
r1102 | .PHONY: test-clean | |||
r1053 | ## run test-clean and tests | |||
test-clean: | ||||
rm -rf coverage.xml htmlcov junit.xml pylint.log result | ||||
find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' | ||||
find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' | ||||
r1040 | .PHONY: test-only | |||
## Run tests only without cleanup | ||||
test-only: | ||||
PYTHONHASHSEED=random \ | ||||
py.test -x -vv -r xw -p no:sugar \ | ||||
r1116 | --cov-report=term-missing --cov-report=html \ | |||
--cov=vcsserver vcsserver | ||||
r1040 | ||||
r1165 | .PHONY: ruff-check | |||
## run a ruff analysis | ||||
ruff-check: | ||||
ruff check --ignore F401 --ignore I001 --ignore E402 --ignore E501 --ignore F841 --exclude rhodecode/lib/dbmigrate --exclude .eggs --exclude .dev . | ||||
r912 | .PHONY: pip-packages | |||
r1040 | ## Show outdated packages | |||
r832 | pip-packages: | |||
python ${OUTDATED_PACKAGES} | ||||
r912 | ||||
r1102 | .PHONY: build | |||
## Build sdist/egg | ||||
build: | ||||
python -m build | ||||
r1040 | ||||
r1172 | .PHONY: dev-sh | |||
## make dev-sh | ||||
dev-sh: | ||||
r1174 | sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list" | |||
r1172 | sudo apt-get update | |||
r1174 | sudo apt-get install -y zsh carapace-bin | |||
r1172 | curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh | |||
r1174 | echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc | |||
r1172 | PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh | |||
r1053 | .PHONY: dev-env | |||
r1102 | ## make dev-env based on the requirements files and install develop of packages | |||
r1165 | ## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y | |||
r1053 | dev-env: | |||
r1115 | pip install build virtualenv | |||
r1090 | pip wheel --wheel-dir=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt | |||
pip install --no-index --find-links=/home/rhodecode/.cache/pip/wheels -r requirements.txt -r requirements_test.txt -r requirements_debug.txt | ||||
r1053 | pip install -e . | |||
r1040 | ||||
r1104 | ||||
r1180 | .PHONY: sh | |||
## shortcut for make dev-sh dev-env | ||||
sh: | ||||
make dev-sh | ||||
make dev-env | ||||
r1104 | .PHONY: dev-srv | |||
r1165 | ## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash | |||
r1104 | dev-srv: | |||
pserve --reload .dev/dev.ini | ||||
r1116 | .PHONY: dev-srv-g | |||
## run gunicorn multi process workers | ||||
dev-srv-g: | ||||
r1150 | gunicorn --workers=4 --paste .dev/dev.ini --bind=0.0.0.0:10010 --config=.dev/gunicorn_config.py | |||
r1116 | ||||
r1165 | ||||
r1040 | # Default command on calling make | |||
.DEFAULT_GOAL := show-help | ||||
.PHONY: show-help | ||||
show-help: | ||||
@echo "$$(tput bold)Available rules:$$(tput sgr0)" | ||||
@echo | ||||
@sed -n -e "/^## / { \ | ||||
h; \ | ||||
s/.*//; \ | ||||
:doc" \ | ||||
-e "H; \ | ||||
n; \ | ||||
s/^## //; \ | ||||
t doc" \ | ||||
-e "s/:.*//; \ | ||||
G; \ | ||||
s/\\n## /---/; \ | ||||
s/\\n/ /g; \ | ||||
p; \ | ||||
}" ${MAKEFILE_LIST} \ | ||||
| LC_ALL='C' sort --ignore-case \ | ||||
| awk -F '---' \ | ||||
-v ncol=$$(tput cols) \ | ||||
-v indent=19 \ | ||||
-v col_on="$$(tput setaf 6)" \ | ||||
-v col_off="$$(tput sgr0)" \ | ||||
'{ \ | ||||
printf "%s%*s%s ", col_on, -indent, $$1, col_off; \ | ||||
n = split($$2, words, " "); \ | ||||
line_length = ncol - indent; \ | ||||
for (i = 1; i <= n; i++) { \ | ||||
line_length -= length(words[i]) + 1; \ | ||||
if (line_length <= 0) { \ | ||||
line_length = ncol - indent - length(words[i]) - 1; \ | ||||
printf "\n%*s ", -indent, " "; \ | ||||
} \ | ||||
printf "%s ", words[i]; \ | ||||
} \ | ||||
printf "\n"; \ | ||||
r1053 | }' | |||