-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (92 loc) · 4.5 KB
/
Copy pathMakefile
File metadata and controls
117 lines (92 loc) · 4.5 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
BUILD_ARGS?=--verbose --release --all-features --locked
CARGO_CLIPPY_ARGS?=-- -D warnings
CARGO_FMT_ARGS?=--all -- --check
CARGO_INSTALL_ARGS?=--path . --bin kickable --debug --force --locked
DOCKER_BUILD_ARGS?=-t $(DOCKER_REPOSITORY):latest
DOCKER_REPOSITORY?=defstream/kickable
.PHONY: clean format lint test docs build clippy test lint sonar/scan install earthly/build earthly/docker earthly/docker/services docker help all check
default: help
all: clean format lint test docs build docker earthly/docker/services ## Runs all the things 😅
help: ## Print this help message 🙋🏽
@grep -E '^[a-zA-Z._-]+:.*?## .*$$' ${MAKEFILE_LIST} | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
clippy: ## Install clippy 🖇️
@rustup -q component add clippy
format: ## Format kickable ℹ
@cargo fmt
check: ## Check kickable ✓
@cargo check ${BUILD_ARGS}
docs: ## Build cargo documentation 📑
@cargo doc --no-deps
build: ## Build kickable 🛠️
@cargo build ${BUILD_ARGS} --all
test: ## Run kickable tests 🧪
@cargo test ${BUILD_ARGS}
lint: clippy check ## Run linting against kickable 🏃🏽
@cargo fmt ${CARGO_FMT_ARGS}
@cargo clippy ${CARGO_CLIPPY_ARGS}
install: ## Install kickable 💻
@cargo install ${CARGO_INSTALL_ARGS}
clean: ## Clean the build artifacts 🧹
@cargo clean
@rm -f *.profraw
# cross-rs publishes amd64-only images; force amd64 so they run (under emulation
# on arm64 hosts) regardless of the Rust target triple being built.
docker: export DOCKER_DEFAULT_PLATFORM := linux/amd64
docker: ## Build docker image and tag as kickable/kickable:latest 🐳
@cross build --release --bin kickable --all-features --locked --target x86_64-unknown-linux-musl
@docker build --platform linux/amd64 -f docker/Dockerfile ${DOCKER_BUILD_ARGS} .
earthly/ci: ## Build cross compiled binaries in docker via Earthly
@earthly --ci +archive
earthly/build: ## Build cross compiled binaries in docker via Earthly
@earthly --ci --output +archive
earthly/docker: ## Build kickable docker app via Earthly
@earthly --ci --push --output +kickable
earthly/docker/services: ## Build kickable docker services via Earthly
@earthly --ci --push +services
depot/docker: export DOCKER_DEFAULT_PLATFORM := linux/amd64
depot/docker: ## Build kickable docker app via Depot (cross-rs builds the binary)
@cross build --release --bin kickable --all-features --locked --target x86_64-unknown-linux-musl
@depot build --platform linux/amd64 -f docker/Dockerfile .
depot/docker/cross: cross/build ## Package cross-compiled distribution archives via Depot
@depot build -f docker/Dockerfile.cross .
score/build: ## Build kickable services via Score
@score-compose run -f ./score/axum.yaml -o ./score/axum.compose.yaml
@score-compose run -f ./score/gotham.yaml -o ./score/gotham.compose.yaml
@score-compose run -f ./score/graphul.yaml -o ./score/graphul.compose.yaml
@score-compose run -f ./score/poem.yaml -o ./score/poem.compose.yaml
@score-compose run -f ./score/rocket.yaml -o ./score/rocket.compose.yaml
@score-compose run -f ./score/rouille.yaml -o ./score/rouille.compose.yaml
@score-compose run -f ./score/tonic.yaml -o ./score/tonic.compose.yaml
@score-compose run -f ./score/viz.yaml -o ./score/viz.compose.yaml
@score-compose run -f ./score/warp.yaml -o ./score/warp.compose.yaml
score/up: ## Launch the score kickable services
@docker compose \
-f score/axum.compose.yaml \
-f score/gotham.compose.yaml \
-f score/graphul.compose.yaml \
-f score/poem.compose.yaml \
-f score/rocket.compose.yaml \
-f score/rouille.compose.yaml \
-f score/tonic.compose.yaml \
-f score/viz.compose.yaml \
-f score/warp.compose.yaml \
-p kickable \
up
cross/build: export DOCKER_DEFAULT_PLATFORM := linux/amd64
cross/build: ## Build cross compiled binaries via cross-rs 🦀
@cross build --release --all-features --locked --target aarch64-apple-darwin
@cross build --release --all-features --locked --target aarch64-unknown-linux-musl
@cross build --release --all-features --locked --target x86_64-apple-darwin
@cross build --release --all-features --locked --target x86_64-pc-windows-gnu
@cross build --release --all-features --locked --target x86_64-unknown-linux-musl
sonar/scan: ## Scan kickable with SonarQube
@docker run \
--rm \
--net host \
-e SONAR_HOST_URL=${SONAR_HOST_URL} \
-v ${PWD}:/usr/src \
sonarsource/sonar-scanner-cli \
-Dsonar.projectKey=kickable \
-Dsonar.sources=/usr/src \
-Dsonar.host.url=${SONAR_HOST_URL} \
-Dsonar.token=${SONAR_TOKEN}