forked from rmfatemi/nutalert
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
54 lines (46 loc) · 1.79 KB
/
Copy pathMakefile
File metadata and controls
54 lines (46 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
.DEFAULT_GOAL := docker
.PHONY: help
help: ## show this help message
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
.PHONY: install
install: ## create virtual environment and install all dependencies
@echo "creating virtual environment"
@python -m venv .venv
@echo "installing dependencies"
@.venv/bin/pip install -r requirements.txt
@.venv/bin/pip install pytest pre-commit deptry
@.venv/bin/pre-commit install
.PHONY: check
check: ## run checks: linting and obsolete dependency check
@echo "linting code: running pre-commit"
@.venv/bin/pre-commit run -a
@echo "checking for obsolete dependencies: running deptry"
@.venv/bin/deptry .
.PHONY: test
test: ## run tests
@.venv/bin/pytest tests/ -v
.PHONY: docker-build
docker-build: ## build the nutalert docker image
docker build -t nutalert -f Dockerfile .
.PHONY: docker-run
docker-run: ## run the container named nutalert using the nutalert image
docker run -p 3493:3493 -p 8087:8087 -v $(shell pwd):/config --name nutalert nutalert
.PHONY: docker
docker: clean docker-build docker-run
.PHONY: clean
clean: ## clean docker containers, volumes, Python cache, build artifacts and temporary files
-docker rm -f nutalert 2>/dev/null || true
-docker volume rm nutalert_data 2>/dev/null || true
@echo "cleaning python cache files..."
find . -type d -name "__pycache__" -exec rm -rf {} +
find . -type f -name "*.pyc" -delete
find . -type f -name "*.pyo" -delete
find . -type f -name "*.pyd" -delete
find . -name ".pytest_cache" -exec rm -rf {} +
find . -name ".coverage" -delete
find . -name "htmlcov" -exec rm -rf {} +
@echo "cleaning build artifacts..."
rm -rf dist/ build/
@echo "cleaning log files..."
find . -name "*.log" -delete
@echo "clean complete"