-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (76 loc) · 2.1 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
##
# Python project makefile.
##
.SHELL := bash
MAKEFLAGS += --warn-undefined-variables
# .SHELLFLAGS := -euo pipefail -c
.DEFAULT_GOAL := none
THIS_MAKEFILE := $(abspath $(firstword $(MAKEFILE_LIST)))
THIS_MAKEFILE := `python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' ${THIS_MAKEFILE}`
SRC_ROOT := $(shell dirname ${THIS_MAKEFILE})
NO_COLOR:=\033[0m
COLOR_GREEN=\033[92m
PY_PKG_NAME:=ssm
.PHONY: build docs
init: py-init
build: py-build
clean: py-clean
py-init:
set -x \
; pip install build \
; pip install --quiet -e .[dev] \
; pip install --quiet -e .[testing] \
; pip install --quiet -e .[publish]
py-build: py-clean
export version=`python setup.py --version` \
&& (git tag $$version \
|| printf 'WARNING: Failed to git-tag with release-tag (this is normal if tag already exists).\n' > /dev/stderr) \
&& printf "# WARNING: file is maintained by automation\n\n__version__ = \"$${version}\"\n\n" \
| tee src/${PY_PKG_NAME}/_version.py \
&& python -m build
py-clean:
rm -rf tmp.pypi* dist/* build/* \
&& rm -rf src/*.egg-info/
find . -name '*.tmp.*' -delete
find . -name '*.pyc' -delete
find . -name __pycache__ -delete
find . -type d -name .tox | xargs -n1 -I% bash -x -c "rm -rf %"
rmdir build || true
version:
@python setup.py --version
pypi-release:
PYPI_RELEASE=1 make py-build \
&& twine upload \
--user $${PYPI_USER} \
--password $${PYPI_TOKEN} \
dist/*
DOCKER_ORG_NAME ?= robotwranglers
DOCKER_IMAGE_NAME ?= aws-ssm-tool
docker-build: build-docker
build-docker:
docker build -t $(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME) .
docker-shell:
docker run -it --entrypoint bash \
$(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME)
tox-%:
tox -e ${*}
normalize: tox-normalize
lint: static-analysis
static-analysis: tox-static-analysis
test-units: utest
test-integrations: itest
smoke-test: stest
docker-test:
docker run --rm -v `pwd`:/workspace -w /workspace \
$(DOCKER_ORG_NAME)/$(DOCKER_IMAGE_NAME)
itest: tox-itest
utest: tox-utest
stest: tox-stest
test: test-units test-integrations smoke-test
plan: docs-plan
apply: docs-apply
docs: docs-apply
docs-apply:
tox -e docs
docs-plan:
tox -e docs-plan