chore(makefile): updated makefile data
This commit is contained in:
parent
ab795f6a4f
commit
1c99ac6b7f
1 changed files with 60 additions and 74 deletions
134
Makefile
134
Makefile
|
|
@ -1,12 +1,49 @@
|
|||
.DEFAULT_GOAL := help
|
||||
|
||||
# Pretty print values cf. https://misc.flogisoft.com/bash/tip_colors_and_formatting
|
||||
RESET := \033[0m # Reset all formatting
|
||||
GREEN := \033[0;32m # Resets before setting 16b colour (32 -- green)
|
||||
YELLOW := \033[0;33m
|
||||
ORANGE := \033[0;38;5;208m # Reset then set 256b colour (208 -- orange)
|
||||
PEACH := \033[0;38;5;216m
|
||||
|
||||
|
||||
## ---------------------------------------------------------------------------------- ##
|
||||
## ------------------------- Help usage builder ------------------------------------- ##
|
||||
## ---------------------------------------------------------------------------------- ##
|
||||
# use '# >>> Build commands' to create section
|
||||
# use '# target: target description' to create help for target
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Usage:"
|
||||
@cat $(MAKEFILE_LIST) | grep -E '^# >>>|^# [A-Za-z0-9_.-]+:' | sed -E 's/^# //' | awk ' \
|
||||
BEGIN { \
|
||||
green="\033[32m"; \
|
||||
yellow="\033[33m"; \
|
||||
reset="\033[0m"; \
|
||||
section=""; \
|
||||
} \
|
||||
/^>>>/ { \
|
||||
section=substr($$0, 5); \
|
||||
printf "\n" green ">>> %s" reset "\n", section; \
|
||||
next; \
|
||||
} \
|
||||
/^([A-Za-z0-9_.-]+):/ { \
|
||||
target=$$1; \
|
||||
gsub(/:$$/, "", target); \
|
||||
description=substr($$0, index($$0, ":") + 2); \
|
||||
if (description == "") { description="-"; } \
|
||||
printf " - " yellow "%-35s" reset " %s\n", target, description; \
|
||||
} \
|
||||
'
|
||||
|
||||
# required for pushd to work..
|
||||
SHELL = /bin/bash
|
||||
|
||||
|
||||
# set by: PATH_TO_OUTDATED_PACKAGES=/some/path/outdated_packages.py
|
||||
OUTDATED_PACKAGES = ${PATH_TO_OUTDATED_PACKAGES}
|
||||
# >>> Tests commands
|
||||
|
||||
.PHONY: clean
|
||||
## Cleanup compiled and cache py files
|
||||
# clean: Cleanup compiled and cache py files
|
||||
clean:
|
||||
make test-clean
|
||||
find . -type f \( -iname '*.c' -o -iname '*.pyc' -o -iname '*.so' -o -iname '*.orig' \) -exec rm '{}' ';'
|
||||
|
|
@ -14,14 +51,14 @@ clean:
|
|||
|
||||
|
||||
.PHONY: test
|
||||
## run test-clean and tests
|
||||
# test: run test-clean and tests
|
||||
test:
|
||||
make test-clean
|
||||
make test-only
|
||||
unset RC_SQLALCHEMY_DB1_URL && unset RC_DB_URL && make test-only
|
||||
|
||||
|
||||
.PHONY: test-clean
|
||||
## run test-clean and tests
|
||||
# test-clean: 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 '{}' ';'
|
||||
|
|
@ -29,34 +66,36 @@ test-clean:
|
|||
|
||||
|
||||
.PHONY: test-only
|
||||
## Run tests only without cleanup
|
||||
# test-only: Run tests only without cleanup
|
||||
test-only:
|
||||
PYTHONHASHSEED=random \
|
||||
py.test -x -vv -r xw -p no:sugar \
|
||||
--cov-report=term-missing --cov-report=html \
|
||||
--cov=rhodecode rhodecode
|
||||
|
||||
# >>> Docs commands
|
||||
|
||||
.PHONY: docs
|
||||
## build docs
|
||||
# docs: build docs
|
||||
docs:
|
||||
(cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean html)
|
||||
|
||||
|
||||
.PHONY: docs-clean
|
||||
## Cleanup docs
|
||||
# docs-clean: Cleanup docs
|
||||
docs-clean:
|
||||
(cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make clean)
|
||||
|
||||
|
||||
.PHONY: docs-cleanup
|
||||
## Cleanup docs
|
||||
# docs-cleanup: Cleanup docs
|
||||
docs-cleanup:
|
||||
(cd docs; docker run --rm -v $(PWD):/project --workdir=/project/docs sphinx-doc-build-rc make cleanup)
|
||||
|
||||
# >>> Dev commands
|
||||
|
||||
.PHONY: web-build
|
||||
## Build JS packages static/js
|
||||
# web-build: Build JS packages static/js
|
||||
web-build:
|
||||
rm -rf node_modules
|
||||
docker run -it --rm -v $(PWD):/project --workdir=/project rhodecode/static-files-build:16 -c "npm install && /project/node_modules/.bin/grunt"
|
||||
|
|
@ -64,25 +103,9 @@ web-build:
|
|||
./rhodecode/tests/scripts/static-file-check.sh rhodecode/public/
|
||||
rm -rf node_modules
|
||||
|
||||
.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 .
|
||||
|
||||
.PHONY: pip-packages
|
||||
## Show outdated packages
|
||||
pip-packages:
|
||||
python ${OUTDATED_PACKAGES}
|
||||
|
||||
|
||||
.PHONY: build
|
||||
## Build sdist/egg
|
||||
build:
|
||||
python -m build
|
||||
|
||||
|
||||
.PHONY: dev-sh
|
||||
## make dev-sh
|
||||
# dev-sh: make dev-sh
|
||||
dev-sh:
|
||||
sudo echo "deb [trusted=yes] https://apt.fury.io/rsteube/ /" | sudo tee -a "/etc/apt/sources.list.d/fury.list"
|
||||
sudo apt-get update
|
||||
|
|
@ -95,14 +118,14 @@ dev-sh:
|
|||
|
||||
|
||||
.PHONY: dev-cleanup
|
||||
## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
|
||||
# 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/*
|
||||
|
||||
|
||||
.PHONY: dev-env
|
||||
## make dev-env based on the requirements files and install develop of packages
|
||||
# dev-env: make dev-env based on the requirements files and install develop of packages
|
||||
## Cleanup: pip freeze | grep -v "^-e" | grep -v "@" | xargs pip uninstall -y
|
||||
dev-env:
|
||||
sudo -u root chown rhodecode:rhodecode /home/rhodecode/.cache/pip/
|
||||
|
|
@ -114,7 +137,7 @@ dev-env:
|
|||
|
||||
|
||||
.PHONY: sh
|
||||
## shortcut for make dev-sh dev-env
|
||||
# sh: shortcut for make dev-sh dev-env
|
||||
sh:
|
||||
make dev-env
|
||||
make dev-sh
|
||||
|
|
@ -124,49 +147,12 @@ sh:
|
|||
workers?=1
|
||||
|
||||
.PHONY: dev-srv
|
||||
## run gunicorn web server with reloader, use workers=N to set multiworker mode
|
||||
# dev-srv: run gunicorn web server with reloader, use workers=N to set multiworker mode, workers=N allows changes of workers
|
||||
dev-srv:
|
||||
gunicorn --paste=.dev/dev.ini --bind=0.0.0.0:10020 --config=.dev/gunicorn_config.py --timeout=120 --reload --workers=$(workers)
|
||||
|
||||
.PHONY: ruff-check
|
||||
# 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 .
|
||||
|
||||
# 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"; \
|
||||
}'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue