Makefile
192 lines
| 5.1 KiB
| text/x-makefile
|
MakefileLexer
r5036 | # required for pushd to work.. | |||
r5013 | SHELL = /bin/bash | |||
r1220 | ||||
r5036 | ||||
r4899 | # set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py | |||
OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES} | ||||
r1 | ||||
r4899 | .PHONY: clean | |||
## Cleanup compiled and cache py files | ||||
r1220 | clean: | |||
make test-clean | ||||
r3476 | find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';' | |||
r5105 | find . -type d -name "build" -prune -exec rm -rf '{}' ';' | |||
r4899 | ||||
r5181 | ||||
r4899 | .PHONY: test | |||
## run test-clean and tests | ||||
r1220 | test: | |||
make test-clean | ||||
make test-only | ||||
r13 | ||||
r4899 | ||||
r5036 | .PHONY: test-clean | |||
r4899 | ## run test-clean and tests | |||
r1220 | test-clean: | |||
rm -rf coverage.xml htmlcov junit.xml pylint.log result | ||||
find . -type d -name "__pycache__" -prune -exec rm -rf '{}' ';' | ||||
r3845 | find . -type f \( -iname '.coverage.*' \) -exec rm '{}' ';' | |||
r1220 | ||||
r4899 | ||||
.PHONY: test-only | ||||
## Run tests only without cleanup | ||||
r1220 | test-only: | |||
r2100 | PYTHONHASHSEED=random \ | |||
r4899 | py.test -x -vv -r xw -p no:sugar \ | |||
--cov-report=term-missing --cov-report=html \ | ||||
--cov=rhodecode rhodecode | ||||
r2100 | ||||
r5036 | ||||
r4899 | .PHONY: test-only-mysql | |||
## run tests against mysql | ||||
r2100 | test-only-mysql: | |||
PYTHONHASHSEED=random \ | ||||
r4899 | py.test -x -vv -r xw -p no:sugar \ | |||
--cov-report=term-missing --cov-report=html \ | ||||
r3976 | --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "mysql://root:qweqwe@localhost/rhodecode_test?charset=utf8"}}' \ | |||
r4899 | --cov=rhodecode rhodecode | |||
r2100 | ||||
r4899 | .PHONY: test-only-postgres | |||
## run tests against postgres | ||||
r2100 | test-only-postgres: | |||
PYTHONHASHSEED=random \ | ||||
r4899 | py.test -x -vv -r xw -p no:sugar \ | |||
--cov-report=term-missing --cov-report=html \ | ||||
r2100 | --ini-config-override='{"app:main": {"sqlalchemy.db1.url": "postgresql://postgres:qweqwe@localhost/rhodecode_test"}}' \ | |||
r4899 | --cov=rhodecode rhodecode | |||
r2100 | ||||
r5176 | .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 . | ||||
r4899 | .PHONY: docs | |||
## build docs | ||||
r13 | docs: | |||
r5193 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html) | |||
r1 | ||||
r4899 | ||||
.PHONY: docs-clean | ||||
## Cleanup docs | ||||
r13 | docs-clean: | |||
r5193 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean) | |||
r13 | ||||
r4899 | ||||
.PHONY: docs-cleanup | ||||
## Cleanup docs | ||||
r1214 | docs-cleanup: | |||
r5193 | (cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup) | |||
r1214 | ||||
r4899 | ||||
.PHONY: web-build | ||||
## Build JS packages static/js | ||||
r1 | web-build: | |||
r5239 | docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt" | |||
r5233 | # run static file check | |||
./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/ | ||||
rm -rf node_modules | ||||
r1 | ||||
r3531 | ||||
r4899 | .PHONY: pip-packages | |||
r5036 | ## Show outdated packages | |||
r4253 | pip-packages: | |||
python ${OUTDATED_PACKAGES} | ||||
r4899 | ||||
r5036 | .PHONY: build | |||
## Build sdist/egg | ||||
build: | ||||
python -m build | ||||
r4899 | ||||
r5191 | .PHONY: dev-sh | |||
## make dev-sh | ||||
dev-sh: | ||||
r5194 | sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list" | |||
r5191 | sudo apt-get update | |||
r5194 | sudo apt-get install -y zsh carapace-bin | |||
r5212 | rm -rf /home/rhodecode/.oh-my-zsh | |||
r5191 | curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh | |||
r5194 | echo "source <(carapace _carapace)" > /home/rhodecode/.zsrc | |||
r5191 | PROMPT='%(?.%F{green}√.%F{red}?%?)%f %B%F{240}%1~%f%b %# ' zsh | |||
r5222 | ||||
.PHONY: dev-cleanup | ||||
## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y | ||||
dev-cleanup: | ||||
pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y | ||||
rm -rf /tmp/* | ||||
r4905 | .PHONY: dev-env | |||
## make dev-env based on the requirements files and install develop of packages | ||||
dev-env: | ||||
r5036 | pip install build virtualenv | |||
r4967 | pushd ../rhodecode-vcsserver/ && make dev-env && popd | |||
r5036 | 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 | |||
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 | ||||
r4905 | pip install -e . | |||
r5036 | ||||
r5209 | .PHONY: sh | |||
## shortcut for make dev-sh dev-env | ||||
sh: | ||||
r5278 | make dev-env | |||
make dev-sh | ||||
r5212 | ||||
r5209 | ||||
r5036 | .PHONY: dev-srv | |||
## run develop server instance, docker exec -it $(docker ps -q --filter 'name=dev-enterprise-ce') /bin/bash | ||||
dev-srv: | ||||
pserve --reload .dev/dev.ini | ||||
r5181 | ||||
r5036 | .PHONY: dev-srv-g | |||
## run gunicorn multi process workers | ||||
dev-srv-g: | ||||
r5275 | gunicorn --paste .dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload | |||
r5036 | ||||
r4899 | # Default command on calling make | |||
.DEFAULT_GOAL := show-help | ||||
r3531 | ||||
r4899 | .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"; \ | ||||
}' | ||||