This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathMakefile
63 lines (48 loc) · 1.6 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
NAME := basaran
VERSION := 0.21.1
DOCKER_HUB_OWNER ?= hyperonym
DOCKER_HUB_IMAGE := $(DOCKER_HUB_OWNER)/$(NAME):$(VERSION)
GITHUB_PACKAGES_OWNER ?= hyperonym
GITHUB_PACKAGES_IMAGE := ghcr.io/$(GITHUB_PACKAGES_OWNER)/$(NAME):$(VERSION)
TARGET_CONTAINER_PLATFORMS := linux/amd64,linux/arm64
.PHONY: build
build:
@python -m build --sdist --wheel --outdir dist/ .
.PHONY: changelog
changelog:
@mkdir -p dist
@git log $(shell git describe --tags --abbrev=0 2> /dev/null)..HEAD --pretty='tformat:* [%h] %s' > dist/changelog.md
@cat dist/changelog.md
.PHONY: clean
clean:
@find . -type f -name "*.py[co]" -delete && find . -type d -name "__pycache__" -delete
@rm -rf .coverage .pytest_cache/ *.egg-info/ build/ dist/ htmlcov/
.PHONY: docker
docker:
@docker build --tag $(DOCKER_HUB_IMAGE) .
.PHONY: docker-hub
docker-hub:
@docker buildx build --push --platform $(TARGET_CONTAINER_PLATFORMS) --tag $(DOCKER_HUB_IMAGE) .
.PHONY: github-packages
github-packages:
@docker buildx build --push --platform $(TARGET_CONTAINER_PLATFORMS) --tag $(GITHUB_PACKAGES_IMAGE) .
.PHONY: github-release
github-release: changelog
@gh release create v$(VERSION) -F dist/changelog.md -t v$(VERSION)
.PHONY: install
install:
@pip install -U pip
@pip install -r requirements.txt
.PHONY: lint
lint:
@flake8 --count --exclude=venv --select=E9,F63,F7,F82 --show-source --statistics
@flake8 --count --exclude=venv --exit-zero --max-complexity=10 --max-line-length=80 --statistics
.PHONY: release
release: changelog build
.PHONY: test
test:
@python -m pytest
.PHONY: test-coverage
test-coverage:
@coverage run -m pytest
@coverage report