-
Notifications
You must be signed in to change notification settings - Fork 292
/
Makefile
87 lines (67 loc) · 2.02 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
run := poetry run
### Most common targets for developing
.PHONY: all
all: check test docs
.PHONY: check
check: pre-commit typecheck
.PHONY: test
test: pytest
.PHONY: fix-and-test
fix-and-test: pre-commit-autofix typecheck pytest
### Package setup
.PHONY: dependencies
dependencies: .flag_installed
.flag_installed: pyproject.toml poetry.lock
poetry install --with dev
@touch .flag_installed
.PHONY: install-hooks
install-hooks: .git/hooks/pre-commit
.git/hooks/pre-commit: .flag_installed .pre-commit-config.yaml
$(run) pre-commit install
.PHONY: clean
clean:
@for folder in .mypy_cache/ .ruff_cache/ .pytest_cache/ dist/ site/; do \
if [[ -d "$$folder" ]]; then \
rm -rfv "$$folder" ; \
fi; \
done
@find . -type d -name __pycache__ -exec rm -rfv "{}" +
@poetry run pre-commit uninstall
@poetry env remove --all -n
@rm -fv coverage.xml .flag_installed
### Check, test, build commands
.PHONY: test-integration
test-integration: .flag_installed
$(run) pytest -m "integration" --cov=acl_anthology --cov-report=xml
.PHONY: pytest
pytest: .flag_installed
$(run) pytest -m "not integration" --cov=acl_anthology --cov-report=xml
.PHONY: typecheck
typecheck: .flag_installed
$(run) mypy acl_anthology
.PHONY: pre-commit
pre-commit: .flag_installed
$(run) pre-commit run --all-files
# Runs pre-commit twice in case of failure, so that it will pass the second time
# if only auto-fixing hooks have triggered
.PHONY: pre-commit-autofix
pre-commit-autofix: .flag_installed
@$(run) pre-commit run --all-files || $(run) pre-commit run --all-files
.PHONY: test-all-python-versions
test-all-python-versions:
@for py in 3.10 3.11 3.12; do \
poetry env use $$py ; \
poetry install --with dev --quiet ; \
poetry run pytest -m "not integration" ; \
done
#.PHONY: autofix
#autofix: .flag_installed
# $(run) black acl_anthology/ tests/
# $(run) ruff check --fix-only acl_anthology/ tests/
### Documentation
.PHONY: docs
docs: .flag_installed
$(run) mkdocs build
.PHONY: docs-serve
docs-serve: .flag_installed
$(run) mkdocs serve