forked from openoakland/woeip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
62 lines (43 loc) · 2.32 KB
/
Makefile
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
55
56
57
58
59
60
61
62
.DEFAULT_GOAL := test
.PHONY: clean detect_missing_migrations help requirements test validate quality production-requirements migrate static clean_static
# Generates a help message. Borrowed from https://github.com/pydanny/cookiecutter-djangopackage.
help: ## Display this help message
@echo "Please use \`make <target>\` where <target> is one of"
@perl -nle'print $& if m{^[\.a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m %-25s\033[0m %s\n", $$1, $$2}'
docker.build: ## Build the Docker containers
docker-compose build
docker.pull: ## Pull the Docker containers
docker-compose pull
%.down: ## Stop the (local|production) Docker containers
docker-compose -f docker-compose.yml -f docker-compose.$*.yml down
%.restart: ## Restart the (local|production) Docker containers
docker-compose -f docker-compose.yml -f docker-compose.$*.yml restart
%.shell: ## Open a shell into the (local|production) app Docker container
docker-compose -f docker-compose.yml -f docker-compose.$*.yml exec app /bin/bash
%.up: ## Start the (local|production) Docker containers
docker-compose -f docker-compose.yml -f docker-compose.$*.yml up -d
clean: ## Delete generated byte code and coverage reports
find . -name '*.pyc' -delete
coverage erase
requirements: ## Install requirements for local development
pipenv install --dev
production-requirements: ## Install requirements for production
pipenv install
test: clean ## Run tests and generate coverage report
coverage run -m pytest --durations=25 -v
coverage report -m
quality: ## Run pep8 and Pylint
isort --check-only --recursive woeip/
pycodestyle woeip *.py
pylint --rcfile=pylintrc woeip *.py
validate: quality test ## Run tests and quality checks
validate_terraform: ## Ensure Terraform files are properly formatted
terraform fmt -diff=true -check
detect_missing_migrations: ## Determine if any apps are missing generated migrations
python manage.py makemigrations --check --dry-run || (echo "Migration files are missing. Please run the "makemigrations" management command, and commit the migrations." && false)
migrate: ## Apply database migrations
python manage.py migrate --noinput
static: ## Gather all static assets for production
python manage.py collectstatic --noinput
clean_static: ## Remove all generated static files
rm -rf woeip/public/