-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
80 lines (63 loc) · 3.35 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
#
# make venv
# Create a python environment for your platform and install the required dependencies int
# it. It will be in ./venv.linux.default if you are Linux
#
# make build
# run pip install in your venv
#
# make lint
# Run several linters on the code
#
# make test
# Run unit tests
#
# NOTE: This does not add the venv to your $PATH. You have to do that yourself if you want that.
#
UNAME?=$(shell uname -s | tr [A-Z] [a-z])
TAG?=default
VENV?=venv.$(UNAME).$(TAG)
PYTHON?=python3.11
FEDITEST?=$(VENV)/bin/feditest -v
DOMAIN?=--domain 1234.lan
default : lint
all : lint tests
build : venv
$(VENV)/bin/pip install .
venv : $(VENV)
$(VENV) :
@which $(PYTHON) || ( echo 'No executable called "python". Append your python to the make command, like "make PYTHON=your-python"' && false )
$(PYTHON) -mvenv $(VENV)
$(VENV)/bin/pip install ruff mypy pylint
lint : build
$(VENV)/bin/ruff check src
MYPYPATH=src $(VENV)/bin/mypy --namespace-packages --explicit-package-bases --install-types --non-interactive src
@# These options should be the same flags as in .pre-commit-config.yml, except that I can't get it to
@# work there without the "--ignore-missing-imports" flag, while it does work without it here
@# MYPYPATH is needed because apparently some type checking ignores the directory option given as command-line argument
@# $(VENV)/bin/pylint src
tests : tests.unit tests.smoke
tests.unit :
$(VENV)/bin/pytest -v
tests.smoke : tests.smoke.webfinger tests.smoke.api tests.smoke.fediverse
tests.smoke.webfinger :
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/webfinger.session.json --node client=tests.smoke/imp.node.json --node server=tests.smoke/wordpress.ubos.node.json $(DOMAIN)
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/webfinger.session.json --node client=tests.smoke/imp.node.json --node server=tests.smoke/mastodon.ubos.node.json $(DOMAIN)
tests.smoke.api :
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api.session.json --node server=tests.smoke/wordpress.ubos.node.json $(DOMAIN)
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api.session.json --node server=tests.smoke/mastodon.ubos.node.json $(DOMAIN)
tests.smoke.fediverse :
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api_mastodon_api.session.json --node leader_node=tests.smoke/mastodon.ubos.node.json --node follower_node=tests.smoke/mastodon.ubos.node.json $(DOMAIN)
$(FEDITEST) run --testsdir tests.smoke/tests --session tests.smoke/mastodon_api_mastodon_api.session.json --node leader_node=tests.smoke/wordpress.ubos.node.json --node follower_node=tests.smoke/mastodon.ubos.node.json $(DOMAIN)
release :
@which $(PYTHON) || ( echo 'No executable called "python". Append your python to the make command, like "make PYTHON=your-python"' && false )
[[ -d venv.release ]] && rm -rf venv.release || true
[[ -d dist ]] && rm -rf dist || true
$(PYTHON) -mvenv venv.release
venv.release/bin/pip install twine
venv.release/bin/pip install --upgrade build
venv.release/bin/python -m build
@echo WARNING: YOU ARE NOT DONE YET
@echo The actual push to pypi.org you need to do manually. Enter:
@echo venv.release/bin/twine upload dist/*
.PHONY: all default venv build lint tests tests.unit tests.smoke tests.smoke.webfinger tests.smoke.api tests.smoke.fediverse release