-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
105 lines (75 loc) · 3.01 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
CLIPPY_OPTS := -D warnings -A clippy::uninlined-format-args
# (method=thread to support xdist)
PYTEST_OPTS := -v -p no:logging $(PYTEST_OPTS)
# If we run the tests in parallel we can speed testing up by a lot, however we
# then don't exit on the first error, since that'd kill the other tester
# processes and result in loads in loads of output. So we only tell py.test to
# abort early if we aren't running in parallel.
ifneq ($(PYTEST_PAR),)
PYTEST_OPTS += -n=$(PYTEST_PAR)
else
PYTEST_OPTS += -x
endif
# Set the individual test timeout
ifneq ($(SLOW_MACHINE),)
PYTEST_OPTS += --timeout 180
else
PYTEST_OPTS += --timeout 30
endif
PYTEST_CMD = . itest-env/bin/activate; PATH="target/debug:$(PATH)" itest-env/bin/pytest itest/tests $(PYTEST_OPTS)
build: build-swapd build-cli
build-cli:
cargo build --manifest-path swap-cli/Cargo.toml
build-swapd:
cargo build --manifest-path swapd/Cargo.toml
check: clippy fmt-check test
clean: clean-test clean-rust
clean-test:
rm -rf itest-env
rm -rf .pytest_cache
rm -rf itest/build
rm -rf itest/tests/__pycache__
rm -rf itest/swapd.egg-info
clean-rust:
rm -rf target
clippy: clippy-main clippy-tests
clippy-main:
cargo clippy -- $(CLIPPY_OPTS)
clippy-tests:
cargo clippy --tests -- $(CLIPPY_OPTS)
fmt: fmt-python fmt-rust
fmt-check: fmt-check-python fmt-check-rust
fmt-check-python: itest-env
itest-env/bin/black ./itest --check
fmt-check-rust:
cargo fmt -- --check
fmt-python: itest-env
itest-env/bin/black ./itest
fmt-rust:
cargo fmt
itest: build itest-env
$(PYTEST_CMD)
itest-cln: build itest-env
$(PYTEST_CMD) --node="cln"
itest-env:
virtualenv itest-env --python=$(which python3) --download --always-copy --clear
itest-env/bin/python3 -m pip install -U pip
itest-env/bin/pip install ./itest
itest-gen-proto: itest-env
. itest-env/bin/activate; \
python -m grpc_tools.protoc -Iswapd/proto/swap --python_out=itest/tests --pyi_out=itest/tests --grpc_python_out=itest/tests swapd/proto/swap/swap.proto; \
python -m grpc_tools.protoc -Iswapd/proto/swap_internal --python_out=itest/tests --pyi_out=itest/tests --grpc_python_out=itest/tests swapd/proto/swap_internal/swap_internal.proto; \
python -m grpc_tools.protoc -Iswapd/proto/lnd --python_out=itest/tests --pyi_out=itest/tests --grpc_python_out=itest/tests swapd/proto/lnd/lightning.proto; \
python -m grpc_tools.protoc -Iswapd/proto/lnd --python_out=itest/tests --pyi_out=itest/tests --grpc_python_out=itest/tests swapd/proto/lnd/walletunlocker.proto; \
python -m grpc_tools.protoc -Iswapd/proto/lnd --python_out=itest/tests --pyi_out=itest/tests --grpc_python_out=itest/tests swapd/proto/lnd/walletkit.proto; \
python -m grpc_tools.protoc -Iswapd/proto/lnd --python_out=itest/tests --pyi_out=itest/tests --grpc_python_out=itest/tests swapd/proto/lnd/signer.proto; \
itest-lnd: build itest-env
$(PYTEST_CMD) --node="lnd"
release: release-swapd release-cli
release-cli:
cargo build --release --manifest-path swap-cli/Cargo.toml
release-swapd:
cargo build --release --manifest-path swapd/Cargo.toml
test: utest itest
utest:
cargo test