-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
64 lines (54 loc) · 1.81 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
# Inspired by: https://blog.mathieu-leplatre.info/tips-for-your-makefile-with-python.html
PYMODULE := project_name
TESTS := tests
INSTALL_STAMP := .install.stamp
POETRY := $(shell command -v poetry 2> /dev/null)
.DEFAULT_GOAL := help
.PHONY: all
all: install cq test
.PHONY: help
help:
@echo "Please use 'make <target>', where <target> is one of"
@echo ""
@echo " install install packages and prepare environment"
@echo " cq run the code linters"
@echo " test run all the tests"
@echo " all install, lint, and test the project"
@echo " clean remove all temporary files listed in .gitignore"
@echo ""
@echo "Check the Makefile to know exactly what each target is doing."
@echo "Most actions are configured in 'pyproject.toml'."
install: $(INSTALL_STAMP)
$(INSTALL_STAMP): pyproject.toml
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi
$(POETRY) install --with dev
touch $(INSTALL_STAMP)
.PHONY: cq
cq: $(INSTALL_STAMP)
# Configured in pyproject.toml
$(POETRY) run ruff format .
$(POETRY) run ruff check --unsafe-fixes --fix .
.PHONY: test
test: $(INSTALL_STAMP)
# Configured in pyproject.toml
$(POETRY) run pytest
.PHONY: clean
clean:
# Delete all files in .gitignore
git clean -Xdf
VERSION ?= latest
IMAGE_NAME = romanzdk/s3-web-browser
.PHONY: release
release:
ifeq ($(VERSION), latest)
@echo "Skipping git tagging for latest version"
else
git tag v$(VERSION)
git push --tags
endif
docker build -t $(IMAGE_NAME):$(VERSION)-arm .
docker push $(IMAGE_NAME):$(VERSION)-arm
docker build -t $(IMAGE_NAME):latest-arm .
docker push $(IMAGE_NAME):latest-arm
docker buildx build --platform linux/amd64 -t $(IMAGE_NAME):$(VERSION) --push .
docker buildx build --platform linux/amd64 -t $(IMAGE_NAME):latest --push .