-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
62 lines (51 loc) · 1.74 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
ENVFILE=.env
include ${ENVFILE}
export
# Do not run tests on tavern_derive directly: panic=abort is not supported
CARGO_TEST_FLAGS=
CARGO_INCREMENTAL=0
CARGO_VERBOSE=false
CARGO_COVERAGE=false
ifeq (${CARGO_NIGHTLY}, true)
CARGO_VERBOSE_FLAG=--verbose
CARGO_COMMAND=rustup run nightly cargo
RUSTUP_TARGET=rustup-nightly
RUSTFLAGS=-Z macro-backtrace --cfg nightly --cfg procmacro2_semver_exempt
else
CARGO_COMMAND=rustup run stable cargo
CARGO_VERBOSE_FLAG=
RUSTUP_TARGET=rustup-stable
RUSTFLAGS=
endif
ifeq (${CARGO_COVERAGE}, true)
RUSTFLAGS=${RUSTFLAGS} -Cpanic=abort -Zpanic_abort_tests -Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off
endif
all: test test-db
postgres:
@if which systemctl &> /dev/null && ! systemctl is-active postgresql; then\
echo "Starting postgresql";\
sudo systemctl start postgresql;\
fi
rustup:
@if ! which rustup &> /dev/null; then\
echo "Rustup is not available and is required. Press enter to install, or Ctrl-C to exit.";\
read unused;\
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh;\
fi
rustup-nightly: rustup
@if [ -z "$(shell rustup toolchain list | grep "nightly-x86_64-unknown-linux-")" ]; then\
echo "Installing nightly toolchain";\
rustup toolchain install nightly;\
fi
rustup-stable: rustup
@if [ -z "$(shell rustup toolchain list | grep "stable-x86_64-unknown-linux-")" ]; then\
echo "Installing stable toolchain";\
rustup toolchain install stable;\
fi
test: ${RUSTUP_TARGET}
${CARGO_COMMAND} test --manifest-path tavern_server/Cargo.toml ${CARGO_TEST_FLAGS}
test-db: export RUST_TEST_THREADS = 1
test-db: ${RUSTUP_TARGET} postgres
${CARGO_COMMAND} test ${CARGO_TEST_FLAGS} --all-features
clean: ${RUSTUP_TARGET}
${CARGO_COMMAND} clean