forked from Boavizta/boaviztapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.45 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
CURRENT_VERSION := $(shell poetry version -s || sed -n '3s/.*version = "\(.*\)"/\1/p' pyproject.toml)
TIMESTAMP := $(shell date "+%H.%M-%m-%d-%y")
DOCKER_NAME := boavizta/boaviztapi:${CURRENT_VERSION}
SEMVERS := major minor patch
MINIMUM_PY_VERSION=3.9
MAXIMUM_PY_VERSION=3.11
clean:
find . -name "*.pyc" -exec rm -rf {} \;
rm -rf dist *.egg-info __pycache__
install: install_pip
install_pip:
poetry install --with dev
test:
poetry run pytest
define compat-check
docker build -t boavizta/boaviztapi-py$(1) \
--target build-env \
--build-arg VERSION=0.0.1 \
--build-arg PY_VERSION=$(1) \
.
docker run \
-v $(shell pwd):/app \
boavizta/boaviztapi-py$(1) \
poetry run pytest
endef
test-compat-min:
$(call compat-check,${MINIMUM_PY_VERSION})
test-compat-max:
$(call compat-check,${MAXIMUM_PY_VERSION})
run:
poetry run uvicorn boaviztapi.main:app
$(SEMVERS):
poetry version $@
$(MAKE) npm_version
$(MAKE) tag_version
npm_version:
npm version --no-git-tag-version ${CURRENT_VERSION}
tag_version:
git commit -m "release: bump to ${CURRENT_VERSION}" pyproject.toml package.json package-lock.json
git tag ${CURRENT_VERSION}
build:
poetry build
distribute:
poetry config pypi-token.pypi ${API_TOKEN}
poetry publish --build
docker-build:
docker build -t $(DOCKER_NAME) . --build-arg VERSION=${CURRENT_VERSION}
docker-build-development:
docker build -t boavizta/boaviztapi:${TIMESTAMP} . --build-arg VERSION=${TIMESTAMP}