-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (25 loc) · 962 Bytes
/
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
SOURCE_FILES = $(wildcard answerset/*.py) answerset/config.json answerset/config.md
OUTPUT_FILE = answerset.ankiaddon
TEST_REPORT_FILE = pytest-junit.xml
GENERATED_FILES = $(TEST_REPORT_FILE) $(OUTPUT_FILE)
CACHE_DIRS = answerset/__pycache__ test/__pycache__ .pytest_cache .mypy_cache .ruff_cache .coverage
ADDONS_DIR = ~/.local/share/Anki2/addons21
INSTALL_DIR = $(ADDONS_DIR)/answerset
COVERAGE_FLAGS = --cov=answerset --cov-fail-under=95 --cov-report=term-missing
RUFF_OUTPUT_FORMAT = full
build: $(OUTPUT_FILE)
install: $(SOURCE_FILES)
[ -d $(INSTALL_DIR) ] || mkdir $(INSTALL_DIR)
ln -f $^ $(INSTALL_DIR)
uninstall:
rm -rf $(INSTALL_DIR)
clean:
rm -rf $(CACHE_DIRS) $(GENERATED_FILES)
test: check
pytest --junitxml=$(TEST_REPORT_FILE) $(COVERAGE_FLAGS)
check:
mypy -p answerset -p test --strict
ruff check --output-format=$(RUFF_OUTPUT_FORMAT)
$(OUTPUT_FILE): $(SOURCE_FILES)
zip -j $@ $^
.PHONY: build install uninstall clean test check