-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
69 lines (51 loc) · 1.53 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
CURRENT_VERSION := $(shell poetry version -s || sed -n '3s/.*version = "\(.*\)"/\1/p' pyproject.toml)
TIMESTAMP := $(shell date "+%m-%d-%y")
DOCKER_NAME := boavizta/boaviztapi:${CURRENT_VERSION}
SEMVERS := major minor patch
MINIMUM_PY_VERSION=3.10
MAXIMUM_PY_VERSION=3.12
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}
docker-run-development:
docker run -p 5000:5000 boavizta/boaviztapi:${TIMESTAMP}