forked from vectordotdev/vrl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
71 lines (53 loc) · 2.39 KB
/
Copy pathMakefile
File metadata and controls
71 lines (53 loc) · 2.39 KB
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
.PHONY: help all clippy fmt fmt-check test vrl-test \
check-typos check-features check-licenses check-msrv check-deny check-wasm32 \
check-docs check-lockfile generate-docs
CARGO_DENY_VERSION := 0.18.9
CARGO_HACK_VERSION := 0.5.29
CARGO_MSRV_VERSION := 0.17.1
DD_LICENSE_TOOL_VERSION := 1.0.6
TYPOS_CLI_VERSION := 1.33.1
# Install a cargo tool at a pinned version if not already installed.
# $(1) = tool name, $(2) = version
define ensure-cargo-tool
@if ! cargo install --list | grep -q "^$(1) v$(2):"; then \
echo "Installing $(1) v$(2)"; \
cargo install $(1) --version $(2) --force --locked; \
fi
endef
help: ## Show available targets
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*##/ {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
all: fmt-check clippy test vrl-test check-licenses check-wasm32 ## Run the common pre-PR checks
clippy: ## Lint with clippy (workspace, all targets, all features)
cargo clippy --workspace --all-targets --all-features -- -D warnings
fmt: ## Format all code
cargo fmt --all
fmt-check: ## Check formatting
cargo fmt --check --all
test: ## Run cargo tests
cargo test --workspace
vrl-test: ## Run VRL integration tests
cargo run --package vrl-tests --bin vrl-tests
check-typos: ## Check spelling with `typos`
$(call ensure-cargo-tool,typos-cli,$(TYPOS_CLI_VERSION))
typos
check-features: ## Verify all feature combinations compile
$(call ensure-cargo-tool,cargo-hack,$(CARGO_HACK_VERSION))
cargo hack check --feature-powerset --depth 1
check-licenses: ## Verify the 3rd-party license file is up to date
$(call ensure-cargo-tool,dd-rust-license-tool,$(DD_LICENSE_TOOL_VERSION))
dd-rust-license-tool check
check-msrv: ## Verify MSRV
$(call ensure-cargo-tool,cargo-msrv,$(CARGO_MSRV_VERSION))
cargo msrv verify
check-deny: ## Run cargo-deny checks
$(call ensure-cargo-tool,cargo-deny,$(CARGO_DENY_VERSION))
cargo deny --log-level error --all-features check all
check-wasm32: ## Check wasm32-unknown-unknown build of the stdlib
rustup target add wasm32-unknown-unknown
cargo check --target wasm32-unknown-unknown --no-default-features --features stdlib
check-docs: ## Check that rustdoc generates cleanly
cargo doc --no-deps --workspace
check-lockfile: ## Verify Cargo.lock is in sync with Cargo.toml
cargo update --workspace --locked
generate-docs: ## Regenerate docs/generated/
cargo run -p vrl-docs -- --output docs/generated/