-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
101 lines (86 loc) · 2.73 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
all: setup format mypy pylint
.PHONY: setup
setup:
@echo $$PATH | grep -q homebrew \
&& echo "Homebrew detected on path" 1>&2 \
&& exit 1 || exit 0
@echo "Current version: $(shell ./get-version.sh)"
poetry install -E gui
.PHONY: format
format:
poetry run isort .
poetry run autopep8 -r --in-place .
.PHONY: test
test: setup
# this really should be done using pytest but ugh
rm -rf test_output
mkdir -p test_output/album/mp3/dir_should_be_removed
touch test_output/album/mp3/extraneous-file.txt
touch test_output/album/mp3/dir_should_be_removed/extraneous-file.txt
poetry run bandcrash -vvv tests/album test_output/album
poetry run bandcrash tests/album/test-options.json test_output/test-options --no-butler
poetry run bandcrash -vvv --init tests/derived test_output/derived --json derived.json
.PHONY: pylint
pylint:
poetry run pylint bandcrash --extension-pkg-allow-list=PySide6
.PHONY: mypy
mypy:
poetry run mypy -p bandcrash --ignore-missing-imports --check-untyped-defs
.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: setup preflight pylint
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
.PHONY: doc
doc:
poetry run sphinx-build -b html docs/ docs/_build -D html_theme=alabaster
.PHONY: app
app: setup format pylint mypy
poetry run pyinstaller Bandcrash.spec -y --clean
.PHONY: upload-mac
upload-mac: preflight app doc
rm -rf dist/macos
mkdir -p dist/macos
cp -a dist/Bandcrash.app dist/macos
cp -a docs/_build dist/macos/docs
butler push dist/macos fluffy/bandcrash:macos \
--userversion=$(shell ./get-version.sh) \
--fix-permissions
.PHONY: upload-win
upload-win: preflight app doc
rm -rf dist/win
mkdir -p dist/win
cp dist/bandcrash-gui.exe dist/win/Bandcrash.exe
cp -a docs/_build dist/win/docs
butler push dist/win fluffy/bandcrash:win \
--userversion=$(shell ./get-version.sh) \
--fix-permissions
.PHONY: upload-linux
upload-linux: preflight app doc
rm -rf dist/linux
mkdir -p dist/linux
cp dist/bandcrash-gui dist/linux/bandcrash
cp -a docs/_build dist/linux/docs
butler push dist/linux fluffy/bandcrash:linux \
--userversion=$(shell ./get-version.sh) \
--fix-permissions