|
| 1 | +# Makefile targets for dvelopment an testing |
| 2 | +# Use make help for more info |
| 3 | + |
| 4 | +.PHONY: help |
| 5 | +help: ## Display this help. |
| 6 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 7 | + |
| 8 | +.PHONY: all |
| 9 | +all: help |
| 10 | + |
| 11 | +##@ Development |
| 12 | + |
| 13 | +.PHONY: venv |
| 14 | +venv: ## Create a Python virtual environment |
| 15 | + $(info Creating Python 3 virtual environment...) |
| 16 | + poetry shell |
| 17 | + |
| 18 | +.PHONY: install |
| 19 | +install: ## Install Python dependencies in virtual environment |
| 20 | + $(info Installing dependencies...) |
| 21 | + poetry config virtualenvs.in-project true |
| 22 | + poetry install |
| 23 | + |
| 24 | +.PHONY: lint |
| 25 | +lint: ## Run the linter |
| 26 | + $(info Running linting...) |
| 27 | + flake8 cldk --count --select=E9,F63,F7,F82 --show-source --statistics |
| 28 | + flake8 cldk --count --max-complexity=10 --max-line-length=180 --statistics |
| 29 | + pylint cldk --max-line-length=180 |
| 30 | + |
| 31 | +.PHONY: test |
| 32 | +test: ## Run the unit tests |
| 33 | + $(info Running tests...) |
| 34 | + pytest --pspec --cov=cldk --cov-fail-under=50 --disable-warnings |
| 35 | + |
| 36 | +##@ Build |
| 37 | + |
| 38 | +.PHONY: clean |
| 39 | +clean: ## Cleans up from previous compiles |
| 40 | + $(info Cleaning up compile artifacts...) |
| 41 | + rm -fr dist |
| 42 | + |
| 43 | +.PHONY: refresh |
| 44 | +refresh: ## Refresh code analyzer |
| 45 | + $(info Refreshing CodeAnalyzer...) |
| 46 | + wget $(curl -s https://api.github.com/repos/IBM/codenet-minerva-code-analyzer/releases/latest | grep "browser_download_url" | grep codeanalyzer.jar | cut -d '"' -f 4) |
| 47 | + mv codeanalyzer.jar cldk/analysis/java/codeanalyzer/jar/codeanalyzer.jar |
| 48 | + |
| 49 | +.PHONY: build |
| 50 | +build: ## Builds a new Python wheel |
| 51 | + $(info Building artifacts...) |
| 52 | + poetry build |
0 commit comments