-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (45 loc) · 2.75 KB
/
Makefile
File metadata and controls
64 lines (45 loc) · 2.75 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
.PHONY: test build
VERSION ?= "dev"
generate-api: ## Generate API types from OpenAPI spec
@echo "Generating API types from OpenAPI spec..."
@which oapi-codegen > /dev/null || (echo "Installing oapi-codegen..." && go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.5.1)
@PATH="$(shell go env GOPATH)/bin:$$PATH" oapi-codegen -config api/oapi-codegen.yaml api/openapi.yaml
validate-api: ## Validate OpenAPI spec
@echo "Validating OpenAPI spec..."
@which oapi-codegen > /dev/null || (echo "Installing oapi-codegen..." && go install github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen@v2.5.1)
@PATH="$(shell go env GOPATH)/bin:$$PATH" oapi-codegen -config api/oapi-codegen.yaml api/openapi.yaml > /dev/null
@echo "✓ OpenAPI spec is valid"
build: generate-api ## Build Daemon
CGO_ENABLED=0 go build -ldflags "-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)" -o ./bin/druid
build-x86-docker:
docker run -e GOOS=linux -e GOARCH=amd64 -it --rm -v ./:/app -w /app --entrypoint=/bin/bash docker.elastic.co/beats-dev/golang-crossbuild:1.22.5-main -c 'CGO_ENABLED=1 go build -ldflags "-X github.com/highcard-dev/daemon/internal.Version=$(VERSION)" -o ./bin/x86/druid'
install: ## Install Daemon
cp ./bin/druid /usr/local/bin/druid
build-plugins: ## Build Plugins
CGO_ENABLED=0 go build -o ./bin/druid_rcon ./plugin/rcon/rcon.go
CGO_ENABLED=0 go build -o ./bin/druid_rcon_web_rust ./plugin/rcon_web_rust/rcon_web_rust.go
proto:
protoc --go_out=paths=source_relative:./ --go-grpc_out=paths=source_relative:./ --go-grpc_opt=paths=source_relative plugin/proto/*.proto
generate-md-docs:
go run ./docs_md/main.go
run: ## Run Daemon
go run main.go
mock:
mockgen -source=internal/core/ports/services_ports.go -destination test/mock/services.go
test:
go test -v ./...
test-clean:
go clean -testcache
go test -v ./test
test-docker:
docker build . -f Dockerfile.testing -t druid-cli-test
docker run -v ./:/app --entrypoint=/bin/bash --rm druid-cli-test -c "go test -v ./..."
test-integration:
go test -timeout 1200s -tags=integration ./test/integration
test-integration-docker:
docker build . -f Dockerfile.testing -t druid-cli-test
docker run -v ./:/app --entrypoint=/bin/bash --rm druid-cli-test -c "go test -timeout 1200s -tags=integration -v ./test/integration"
docker run -v ./:/app --entrypoint=/bin/bash --rm druid-cli-test -c "go test -timeout 1200s -tags=integration -v ./test/integration/commands"
test-integration-docker-debug:
docker build . -f Dockerfile.testing -t druid-cli-test
docker run -v ./:/app --entrypoint=/bin/bash --rm -p 2345:2345 -it druid-cli-test -c "dlv --listen=:2345 --headless=true --log=true --log-output=debugger,debuglineerr,gdbwire,lldbout,rpc --accept-multiclient --api-version=2 test ./test/integration/commands"