forked from fermyon/spin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (67 loc) · 2.99 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
LOG_LEVEL_VAR ?= RUST_LOG=spin=trace
CERT_NAME ?= local
SPIN_DOC_NAME ?= new-doc.md
export PATH := target/debug:target/release:$(HOME)/.cargo/bin:$(PATH)
## overrides for Windows
ifeq ($(OS),Windows_NT)
LOG_LEVEL_VAR =
endif
.PHONY: build
build:
cargo build --release
.PHONY: install
install:
cargo install --path . --locked
.PHONY: test
test: lint test-unit test-integration
.PHONY: lint
lint:
cargo clippy --all --all-targets --features all-tests -- -D warnings
cargo fmt --all -- --check
.PHONY: lint-rust-examples
lint-rust-examples:
for manifest_path in $$(find examples -name Cargo.toml); do \
echo "Linting $${manifest_path}" \
&& cargo clippy --manifest-path "$${manifest_path}" -- -D warnings \
&& cargo fmt --manifest-path "$${manifest_path}" -- --check \
&& (git diff --name-status --exit-code . || (echo "Git working tree dirtied by lints. Run 'make update-cargo-locks' and check in changes" && false)) \
|| exit 1 ; \
done
.PHONY: lint-all
lint-all: lint lint-rust-examples
## Bring all of the checked in `Cargo.lock` files up-to-date
.PHONY: update-cargo-locks
update-cargo-locks:
echo "Updating Cargo.toml"
cargo update -w --offline; \
for manifest_path in $$(find examples -name Cargo.toml); do \
echo "Updating $${manifest_path}" && \
cargo update --manifest-path "$${manifest_path}" -w --offline; \
done
.PHONY: test-unit
test-unit:
$(LOG_LEVEL_VAR) cargo test --all --no-fail-fast -- --skip integration_tests --skip runtime_tests --nocapture
.PHONY: test-crate
test-crate:
$(LOG_LEVEL_VAR) cargo test -p $(crate) --no-fail-fast -- --skip integration_tests --skip runtime_tests --nocapture
# Run the runtime tests without the tests that use some sort of assumed external dependency (e.g., Docker, a language toolchain, etc.)
.PHONY: test-runtime
test-runtime:
cargo test --release runtime_tests --no-default-features --no-fail-fast -- --nocapture
# Run all of the runtime tests including those that use some sort of assumed external dependency (e.g., Docker, a language toolchain, etc.)
.PHONY: test-runtime-full
test-runtime-full:
cargo test --release runtime_tests --no-default-features --features extern-dependencies-tests --no-fail-fast -- --nocapture
# Run the integration tests without the tests that use some sort of assumed external dependency (e.g., Docker, a language toolchain, etc.)
.PHONY: test-integration
test-integration: test-runtime
cargo test --release integration_tests --no-default-features --no-fail-fast -- --nocapture
# Run all of the integration tests including those that use some sort of assumed external dependency (e.g., Docker, a language toolchain, etc.)
.PHONY: test-integration-full
test-integration-full: test-runtime-full
cargo test --release integration_tests --no-default-features --features extern-dependencies-tests --no-fail-fast -- --nocapture
# simple convenience for developing with TLS
.PHONY: tls
tls: ${CERT_NAME}.crt.pem
$(CERT_NAME).crt.pem:
openssl req -newkey rsa:2048 -nodes -keyout $(CERT_NAME).key.pem -x509 -days 365 -out $(CERT_NAME).crt.pem