-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (62 loc) · 2.17 KB
/
Makefile
File metadata and controls
82 lines (62 loc) · 2.17 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
72
73
74
75
76
77
78
79
80
81
82
# Auto-detect musl target for static binaries (Linux only)
# Only set MUSL_TARGET on supported architectures; targets that need it will check
MUSL_TARGET := $(shell uname -m | sed 's/^x86_64$$/x86_64-unknown-linux-musl/;s/^aarch64$$/aarch64-unknown-linux-musl/')
define check-musl-target
$(if $(filter %unknown-linux-musl,$(MUSL_TARGET)),,$(error Unsupported architecture: $(shell uname -m). Static musl builds only supported on Linux x86_64 and aarch64))
endef
# Use --locked in CI to ensure reproducible builds
CARGO_LOCKED := $(if $(CI),--locked,)
.PHONY: default
default: compile
.PHONY: check-shell-permissions
check-shell-permissions:
./ci/check-scripts-permissions.sh
.PHONY: check-rust-formatting
check-rust-formatting:
cargo fmt --all -- --check --config=group_imports=StdExternalCrate
.PHONY: fix-rust-formatting
fix-rust-formatting:
cargo fmt --all -- --config=group_imports=StdExternalCrate
.PHONY: check-shell-formatting
check-shell-formatting:
shfmt --simplify --diff ci/*
.PHONY: fix-shell-formatting
fix-shell-formatting:
shfmt --simplify --write ci/*
.PHONY: check-yaml-formatting
check-yaml-formatting:
yamlfmt -verbose -lint -dstar .github/workflows/*
.PHONY: fix-yaml-formatting
fix-yaml-formatting:
yamlfmt -verbose -dstar .github/workflows/*
.PHONY: check-rust-linting
check-rust-linting:
cargo clippy --verbose $(CARGO_LOCKED) -- -D warnings
.PHONY: check-shell-linting
check-shell-linting:
shellcheck ci/*.sh
.PHONY: check-github-actions-workflows-linting
check-github-actions-workflows-linting:
actionlint -verbose -color
.PHONY: check-rust-dependencies
check-rust-dependencies:
cargo machete
.PHONY: compile
compile:
cargo build --verbose $(CARGO_LOCKED)
.PHONY: unit-test
unit-test:
cargo test --verbose $(CARGO_LOCKED)
.PHONY: release
release:
$(call check-musl-target)
cargo build --release --target=$(MUSL_TARGET) --locked --verbose
.PHONY: publish-binary
publish-binary: release
./ci/publish-binary.sh ${RELEASE} $(MUSL_TARGET)
.PHONY: publish-docker-image
publish-docker-image:
./ci/publish-docker-image.sh ${RELEASE} ${PLATFORM} ${TARGET} ${SUFFIX}
.PHONY: publish-docker-manifest
publish-docker-manifest:
./ci/publish-docker-manifest.sh ${RELEASE}