-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
114 lines (88 loc) · 3.04 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
114
RUST_DOCKER_IMAGE=rust:latest
CERT_OPTS ?=
PFX_OPTS ?= ""
CARGO_TEST_OPTS ?= ""
build-all:
cargo build --all-features
.PHONY: certs
certs:
make -C certs generate-certs PFX_OPTS=${PFX_OPTS}
cert-patch-macos:
sed -i '' 's/RSA PRIVATE KEY/PRIVATE KEY/' certs/test-certs/server-hs.key
.PHONY: test-all run-test-all
test-all: certs test-derive setup-http-server run-test-all
run-test-all:
TEST_PORT=$$(cat tmp-PORT) cargo test --all-features
$(MAKE) teardown-http-server
.PHONY: test-http run-test-http
test-http: certs setup-http-server run-test-http
run-test-http:
TEST_PORT=$$(cat tmp-PORT) cargo test --all-features test_http_client
$(MAKE) teardown-http-server
# test all features but just rust_tls option on macos
test-macos: PFX_OPTS=""
test-macos: certs cert-patch-macos test-derive setup-http-server run-test-macos
run-test-macos:
TEST_PORT=$$(cat tmp-PORT) cargo test \
--features "task,subscriber,fixture,task_unstable,io,sync,future,net,tls,timer,fs,zero_copy,retry,doomsday,tokio1"
$(MAKE) teardown-http-server
install-wasm-pack:
which wasm-pack || curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
test-wasm: install-wasm32 install-wasm-pack
wasm-pack test --firefox --headless
wasm-pack test --chrome --headless
test-wasm-safari: install-wasm32 install-wasm-pack
wasm-pack test --safari --headless
test-derive:
cd fluvio-future-derive; cargo test
check-wasm: install-wasm32
cargo build --target wasm32-unknown-unknown --all-features
install_windows_on_mac:
rustup target add x86_64-pc-windows-gnu
brew install mingw-w64
install_linux:
rustup target add x86_64-unknown-linux-musl
# build linux version
build_linux: install_linux
cargo build --target ${TARGET_LINUX}
# build windows version
build-windows:
cargo build --target=x86_64-pc-windows-gnu
install-fmt:
rustup component add rustfmt
check-fmt: install-fmt
cargo fmt -- --check
install-clippy:
rustup component add clippy
install-wasm32:
rustup target add wasm32-unknown-unknown
setup-http-server: certs $(CERT_OPTS)
# cargo binstall -y http-server
# cargo binstall -y portpicker-cli
cargo install http-server
cargo install portpicker-cli
portpicker > tmp-PORT
echo Picked port $$(cat tmp-PORT)
http-server --tls \
--tls-key certs/test-certs/server-hs.key \
--tls-cert certs/test-certs/server.crt \
--tls-key-algorithm pkcs8 -p $$(cat tmp-PORT) &
teardown-http-server:
killall http-server
rm -f tmp-PORT
check-clippy: install-clippy install-wasm32
cargo clippy --all-features
cargo check --target wasm32-unknown-unknown --all-features
cargo_cache_dir:
mkdir -p .docker-cargo
docker_linux_test: cargo_cache_dir
docker run --rm --volume ${PWD}:/src --workdir /src \
-e USER -e CARGO_HOME=/src/.docker-cargo \
-e CARGO_TARGET_DIR=/src/target-docker \
${RUST_DOCKER_IMAGE} cargo test
docker_linux_test_large: cargo_cache_dir
docker run --rm --volume ${PWD}:/src --workdir /src \
-e USER -e CARGO_HOME=/src/.docker-cargo \
-e CARGO_TARGET_DIR=/src/target-docker \
--env RUST_LOG=trace \
${RUST_DOCKER_IMAGE} cargo test zero_copy_large_size