forked from agentgateway/agentgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
112 lines (94 loc) · 2.8 KB
/
Makefile
File metadata and controls
112 lines (94 loc) · 2.8 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
# Image configuration
DOCKER_REGISTRY ?= ghcr.io
DOCKER_REPO ?= agentgateway
IMAGE_NAME ?= agentgateway
VERSION ?= $(shell git describe --tags --always --dirty)
IMAGE_TAG ?= $(VERSION)
IMAGE_FULL_NAME ?= $(DOCKER_REGISTRY)/$(DOCKER_REPO)/$(IMAGE_NAME):$(IMAGE_TAG)
DOCKER_BUILDER ?= docker
DOCKER_BUILD_ARGS ?=
KIND_CLUSTER_NAME ?= agentgateway
# docker
.PHONY: docker
docker:
ifeq ($(OS),Windows_NT)
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -f Dockerfile.windows -t $(IMAGE_FULL_NAME) .
else
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -t $(IMAGE_FULL_NAME) . --progress=plain
endif
.PHONY: docker-musl
docker-musl:
$(DOCKER_BUILDER) build $(DOCKER_BUILD_ARGS) -t $(IMAGE_FULL_NAME)-musl --build-arg=BUILDER=musl . --progress=plain
CARGO_BUILD_ARGS ?=
# build
.PHONY: build
build:
cargo build --release --features ui $(CARGO_BUILD_ARGS)
.PHONY: build-target
build-target:
cargo build --features ui $(CARGO_BUILD_ARGS) --target $(TARGET) --profile $(PROFILE)
# lint
.PHONY: lint
lint:
cargo fmt --check
cargo clippy --all-targets -- -D warnings
.PHONY: fix-lint
fix-lint:
cargo clippy --fix --allow-staged --allow-dirty --workspace
cargo fmt
# test
.PHONY: test
test:
cargo test --all-targets
# clean
.PHONY: clean
clean:
cargo clean
objects := $(wildcard examples/*/config.json)
.PHONY: check-clean-repo
check-clean-repo:
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -Command common/scripts/check_clean_repo.ps1
else
@common/scripts/check_clean_repo.sh
endif
.PHONY: gen
gen: generate-apis generate-schema fix-lint
@:
.PHONY: generate-schema
generate-schema:
@cargo xtask schema
# Code generation for xds apis
.PHONY: generate-apis
generate-apis:
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -Command common/tools/buf.ps1 generate --path crates/agentgateway/proto/resource.proto --path crates/agentgateway/proto/workload.proto
else
@PATH=./common/tools:$(PATH) buf generate --path crates/agentgateway/proto/resource.proto --path crates/agentgateway/proto/workload.proto
endif
.PHONY: run-validation-deps
run-validation-deps:
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -Command common/scripts/manage-validation-deps.ps1 start
else
@common/scripts/manage-validation-deps.sh start
endif
.PHONY: stop-validation-deps
stop-validation-deps:
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -Command common/scripts/manage-validation-deps.ps1 stop
else
@common/scripts/manage-validation-deps.sh stop
endif
CONFIG_FILES := $(wildcard examples/*/config.yaml)
ifeq ($(CI),true)
ifeq ($(OS),Windows_NT)
# On Windows
CONFIG_FILES := $(filter-out examples/mcp-authentication/config.yaml, $(CONFIG_FILES))
endif
endif
.PHONY: validate
validate: run-validation-deps $(CONFIG_FILES) stop-validation-deps
.PHONY: $(CONFIG_FILES)
$(CONFIG_FILES):
@cargo run -- -f $@ --validate-only