summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 2700bf7a96887041f1b8e923a64cfb62ec3500d6 (plain)
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
NAME    := asciinema
VERSION := $(shell python3 -c "import asciinema; print(asciinema.__version__)")

VIRTUAL_ENV ?= .venv

.PHONY: test
test: test.unit test.integration

.PHONY: test.unit
test.unit:
	pytest

.PHONY: test.integration
test.integration:
	tests/integration.sh

.PHONY: test.distros
test.distros:
	tests/distros.sh

.PHONY: release
release: test tag push

.PHONY: release.test
release.test: test push.test

.PHONY: .tag.exists
.tag.exists:
	@git tag \
		| grep -q "v$(VERSION)" \
		&& echo "Tag v$(VERSION) exists" \
		&& exit 1

.PHONY: tag
tag: .tag.exists
	git tag -s -m "Releasing $(VERSION)" v$(VERSION)
	git push origin v$(VERSION)

.PHONY: .venv
.venv:
	python3 -m venv $(VIRTUAL_ENV)

.PHONY: .pip
.pip: .venv
	. $(VIRTUAL_ENV)/bin/activate \
		&& python3 -m pip install --upgrade build twine

build: .pip
	. $(VIRTUAL_ENV)/bin/activate \
		&& python3 -m build .

install: build
	. $(VIRTUAL_ENV)/bin/activate \
		&& python3 -m pip install .

.PHONY: push
push: .pip build
	python3 -m twine upload dist/*

.PHONY: push.test
push.test: .pip build
	python3 -m twine upload --repository testpypi dist/*


.PHONY: clean
clean:
	rm -rf dist *.egg-info

clean.all: clean
	find .  \
		-type d \
		-name __pycache__ \
		-o -name .pytest_cache \
		-o -name .mypy_cache \
		-exec rm -r "{}" +