-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (36 loc) · 1.06 KB
/
Copy pathMakefile
File metadata and controls
46 lines (36 loc) · 1.06 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
.PHONY: fmt test clippy ci coverage sq sq-ci sonar run
SONAR_SCANNER ?= sonar-scanner
SONAR_ARGS ?= -Dsonar.qualitygate.wait=true
fmt:
cargo fmt --check
test:
cargo test --all-targets
clippy:
cargo clippy --all-targets -- -D warnings
ci: fmt test clippy
coverage:
@cargo llvm-cov --version >/dev/null 2>&1 || { \
echo "cargo-llvm-cov is required. Install with: cargo install cargo-llvm-cov"; \
exit 1; \
}
@rustup component list --installed | grep -q '^llvm-tools-' || { \
echo "llvm-tools-preview is required. Install with: rustup component add llvm-tools-preview"; \
exit 1; \
}
mkdir -p target/coverage
rustup run stable cargo llvm-cov --all-targets --workspace --cobertura --output-path target/coverage/coverage.xml
sq-ci: coverage
sq:
@test -n "$$SONAR_TOKEN" || { \
echo "SONAR_TOKEN must be set in the environment."; \
exit 1; \
}
@command -v $(SONAR_SCANNER) >/dev/null 2>&1 || { \
echo "$(SONAR_SCANNER) is required for local SonarQube scans."; \
exit 1; \
}
@$(MAKE) coverage
$(SONAR_SCANNER) $(SONAR_ARGS)
sonar: sq
run:
cargo run