forked from helxplatform/dug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
80 lines (63 loc) · 2.24 KB
/
Makefile
File metadata and controls
80 lines (63 loc) · 2.24 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
PYTHON = /usr/bin/env python3
VERSION_FILE = ./src/dug/_version.py
VERSION = $(shell cut -d " " -f 3 ${VERSION_FILE})
DOCKER_REPO = docker.io
DOCKER_OWNER = helxplatform
DOCKER_APP = dug
DOCKER_TAG = ${VERSION}
DOCKER_IMAGE = ${DOCKER_OWNER}/${DOCKER_APP}:$(DOCKER_TAG)
.DEFAULT_GOAL = help
.PHONY: help clean install test build image publish
#help: List available tasks on this project
help:
@grep -E '^#[a-zA-Z\.\-]+:.*$$' $(MAKEFILE_LIST) | tr -d '#' | awk 'BEGIN {FS = ": "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
#clean: Remove old build artifacts and installed packages
clean:
rm -rf build
rm -rf dist
rm -rf src/dug.egg-info
${PYTHON} -m pip uninstall -y dug
${PYTHON} -m pip uninstall -y -r requirements.txt
#install: Install application along with required development packages
install:
${PYTHON} -m pip install --upgrade pip
${PYTHON} -m pip install -r requirements.txt
${PYTHON} -m pip install .
#test.lint: Run flake8 on the source code
test.lint:
${PYTHON} -m flake8 src
#test.doc: Run doctests in the source code
test.doc:
${PYTHON} -m pytest --doctest-modules src
#test.unit: Run unit tests
test.unit:
${PYTHON} -m pytest tests/unit
#test: Run all tests
test: test.doc test.unit
#build: Build wheel and source distribution packages
build.python:
echo "Building distribution packages for version $(VERSION)"
${PYTHON} -m pip install --upgrade build
${PYTHON} -m build --sdist --wheel .
echo "Successfully built version $(VERSION)"
#build.image: Build the Docker image
build.image:
echo "Building docker image: ${DOCKER_IMAGE}"
docker build -t ${DOCKER_IMAGE} -f Dockerfile .
echo "Successfully built: ${DOCKER_IMAGE}"
build.image.test:
echo "Testing dockerfile"
#build: Build Python artifacts and Docker image
build: build.python build.image build.image.test
#all: Alias to clean, install, test, build, and image
all: clean install test build
#publish.image: Push the Docker image
publish.image:
docker tag ${DOCKER_IMAGE} ${DOCKER_REPO}/${DOCKER_IMAGE}
docker push ${DOCKER_REPO}/${DOCKER_IMAGE}
#publish.python: Push the build artifacts to PyPI
publish.python:
echo "publishing wheel..."
echo "publishing source..."
#publish: Push all build artifacts to appropriate repositories
publish: publish.python publish.image