-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (43 loc) · 2.02 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
# Heavily inspired by / copied from https://github.com/tj-django/django-clone/blob/main/Makefile (thank you)
# Self-Documented Makefile see https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.DEFAULT_GOAL := help
# Put it first so that "make" without argument is like "make help".
help:
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-32s-\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
.PHONY: help
# --------------------------------------------------------
# ------- Commands ---------------------------------------
# --------------------------------------------------------
ARCH?=arm64v8
docker_arch: ## set the arch environment variable for docker
@export ARCH=$(ARCH)
docker_up: docker_arch ## runs docker compose up
docker-compose -f local.yml up -d django
coverage: docker_up ## runs pytest and outputs coverage to coverage.xml
docker-compose -f local.yml exec django pytest --cov lazy_srcset --cov-report xml
clean: clean-test clean-build clean-pyc ## remove all build, test, coverage and Python artifacts
clean-test: ## remove test and coverage artifacts
rm -rf .tox/
rm -f .coverage
rm -rf htmlcov/
rm -rf .pytest_cache
clean-build: ## remove build artifacts
rm -rf build/
rm -rf dist/
rm -rf .eggs/
find . -name '*.egg-info' -exec rm -rf {} +
find . -name '*.egg' -exec rm -f {} +
clean-pyc: ## remove Python file artifacts
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
find . -name '__pycache__' -exec rm -rf {} +
dist: clean ## builds source and wheel package
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade build twine
python3 -m build
# Note .pypirc is an untracked file containing secrets for auth with pypi.org
# todo consider automating commit, tag and push?
release: coverage dist ## package and upload a release, to make a new release first update the version number in setup.cfg
twine upload --config-file .pypirc dist/*
@echo "Package published to pypi! Now commit changes and push."