-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (43 loc) · 1.12 KB
/
Makefile
File metadata and controls
52 lines (43 loc) · 1.12 KB
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
all: setup format mypy pylint flake8
.PHONY: setup
setup:
@echo "Current version: $(shell ./get-version.sh)"
poetry install
.PHONY: format
format:
poetry run isort .
poetry run autopep8 -r --in-place .
.PHONY: pylint
pylint:
poetry run pylint reblob
.PHONY: flake8
flake8:
poetry run flake8
.PHONY: mypy
mypy:
poetry run mypy -p reblob --ignore-missing-imports
.PHONY: preflight
preflight:
@echo "Checking commit status..."
@git status --porcelain | grep -q . \
&& echo "You have uncommitted changes" 1>&2 \
&& exit 1 || exit 0
@echo "Checking branch..."
@[ "$(shell git rev-parse --abbrev-ref HEAD)" != "main" ] \
&& echo "Can only build from main" 1>&2 \
&& exit 1 || exit 0
@echo "Checking upstream..."
@git fetch \
&& [ "$(shell git rev-parse main)" != "$(shell git rev-parse main@{upstream})" ] \
&& echo "main branch differs from upstream" 1>&2 \
&& exit 1 || exit 0
.PHONY: build
build: preflight pylint flake8
poetry build
.PHONY: clean
clean:
rm -rf dist .mypy_cache .pytest_cache .coverage
find . -name __pycache__ -print0 | xargs -0 rm -r
.PHONY: upload
upload: clean test build
poetry publish