-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (64 loc) · 1.48 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
VENV := ./.venv/bin
VERSION ?= $(shell rye version)
.PHONY: install
install:
rye sync
$(VENV)/pre-commit install
$(VENV)/playwright install chromium
.PHONY: lint
lint:
$(VENV)/ruff check src
$(VENV)/pylint src
.PHONY: lint-fix
lint-fix:
$(VENV)/ruff check --fix src
.PHONY: format
format:
# sort imports
$(VENV)/ruff check --select I --fix src
# format code
$(VENV)/ruff format --diff src || true
$(VENV)/ruff format src
.PHONY: test
test:
$(VENV)/pytest \
--cov-report term-missing:skip-covered \
--cov-report html \
--cov-report xml \
--junitxml=junit.xml \
-vvv \
--pyargs ridiwise \
--cov src \
| tee pytest-coverage.txt
clean:
rm -rf .coverage htmlcov coverage.xml pytest-coverage.txt junit.xml
### Docker
DOCKER_REPO ?= bskim45/ridiwise
LATEST_IMAGE := $(DOCKER_REPO):latest
VERSION_IMAGE := $(DOCKER_REPO):$(shell rye version)
.PHONY: docker-build
docker-build:
docker build \
-t $(LATEST_IMAGE) -t $(VERSION_IMAGE) \
--build-arg VERSION=$(VERSION) \
--build-arg REVISION=$(shell git rev-parse HEAD) \
.
.PHONY: docker-buildx
docker-buildx:
docker buildx build \
-t $(LATEST_IMAGE) -t $(VERSION_IMAGE) \
--platform linux/amd64,linux/arm64 \
--build-arg VERSION=$(VERSION) \
--build-arg REVISION=$(shell git rev-parse HEAD) \
--output="type=image" \
.
.PHONY: docker-push
push: build
docker push $(LATEST_IMAGE)
docker push $(VERSION_IMAGE)
.PHONY: bump-version
BUMP_TYPE ?= minor
bump-version:
$(VENV)/bump-my-version bump $(BUMP_TYPE)
%:
@: