forked from algorand/pyteal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
113 lines (75 loc) · 2.58 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
101
102
103
104
105
106
107
108
109
110
111
112
113
# ---- Setup ---- #
setup-development:
pip install -e .
pip install -r requirements.txt --upgrade
setup-docs:
pip install -r docs/requirements.txt
pip install doc2dash
setup-wheel:
pip install wheel
generate-init:
python -m scripts.generate_init
# ---- Docs and Distribution ---- #
bdist-wheel:
python setup.py sdist bdist_wheel
bundle-docs-clean:
rm -rf docs/pyteal.docset
bundle-docs: bundle-docs-clean
cd docs && \
make html SPHINXOPTS="-W --keep-going" && \
doc2dash --name pyteal --index-page index.html --online-redirect-url https://pyteal.readthedocs.io/en/ _build/html && \
tar -czvf pyteal.docset.tar.gz pyteal.docset
# ---- Code Quality ---- #
check-generate-init:
python -m scripts.generate_init --check
ALLPY = docs examples pyteal scripts tests *.py
black:
black --check $(ALLPY)
flake8:
flake8 $(ALLPY)
mypy:
mypy
sdist-check:
python setup.py check -s
python setup.py check -s 2>&1 | (! grep -qEi 'error|warning')
lint: black flake8 mypy sdist-check
# ---- Unit Tests (no algod) ---- #
# TODO: add blackbox_test.py to multithreaded tests when following issue has been fixed https://github.com/algorand/pyteal/issues/199
NUM_PROCS = auto
test-unit-async:
pytest -n $(NUM_PROCS) --durations=10 -sv pyteal tests/unit -m "not serial"
test-unit-sync:
pytest --durations=10 -sv pyteal tests/unit -m serial
test-unit: test-unit-async test-unit-sync
lint-and-test: check-generate-init lint test-unit
# ---- Integration Tests (algod required) ---- #
algod-start:
docker compose up -d algod --wait
algod-version:
docker compose exec algod goal --version
algod-start-report: algod-start algod-version
algod-stop:
docker compose stop algod
integration-run:
pytest -n $(NUM_PROCS) --durations=10 -sv tests/integration -m "not serial"
pytest --durations=10 -sv tests/integration -m serial
test-integration: integration-run
all-tests: lint-and-test test-integration
# ---- Github Actions 1-Liners ---- #
setup-build-test: setup-development lint-and-test
algod-integration: algod-start setup-development test-integration algod-stop
check-code-changes:
git config --global --add safe.directory /__w/pyteal/pyteal
[ -n "$$(git log --since='24 hours ago')" ] && (echo "should_run=true" >> $(GITHUB_ENV)) || (echo "should_run=false" >> $(GITHUB_ENV))
nightly-slow:
echo "TODO - this is a stub for a very slow test"
# ---- Local Github Actions Simulation via `act` ---- #
# assumes act is installed, e.g. via `brew install act`
ACT_JOB = run-integration-tests
local-gh-job:
act -j $(ACT_JOB)
local-gh-simulate:
act
# ---- Extras ---- #
coverage:
pytest --cov-report html --cov=pyteal