PROJECT_NAME := $(shell basename $(shell pwd)) GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g') IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH) .PHONY: clean setup build test run bin/authzd: @go build -o ./bin/authzd ./cmd/authzd/main.go bin/sparkled: @go build -o ./bin/sparkled ./cmd/sparkled/main.go bin/sts: @go build -o ./bin/sts ./cmd/sts/main.go clean: @rm -f ./bin/authzd ./bin/sparkled ./bin/sts @go clean -testcache setup: @MISE_CONFIG_FILE=.tool-versions MISE_GLOBAL_CONFIG_FILE="" mise install @go mod tidy @go mod vendor @go tool @if command -v brew >/dev/null 2>&1; then \ echo "Installing Homebrew packages..."; \ brew bundle; \ else \ echo "Homebrew not found, skipping brew bundle"; \ fi @echo "Installing Python dependencies..." pip install dumb-init build: bin/authzd bin/sparkled bin/sts test-unit: @go test -shuffle=on ./... test-race: @CGO_ENABLED=1 go test -race -shuffle=on ./... test-integration: build-image @IMAGE_TAG=$(IMAGE_TAG) go test -tags=integration ./test/integration/... test: clean test-unit test-integration build-image: @docker build --no-cache --tag $(IMAGE_TAG) . build-builder-image: @docker build --target build --tag $(IMAGE_TAG) . run: clean build @go tool godotenv -f .env.local,.env ./bin/entrypoint.sh run-authzd: clean build @go tool godotenv -f .env.local,.env ./bin/authzd run-image: clean build-image @docker run --rm --network host --env-file .env.local -p 10000:10000 -p 9901:9901 -p 8080:8080 -it $(IMAGE_TAG) run-envoy: @go tool godotenv -f .env.local,.env ./bin/envoy.sh run-sparkled: clean build @go tool godotenv -f .env.local,.env ./bin/sparkled run-sts: clean build @go tool godotenv -f .env.local,.env ./bin/sts sh-image: build-builder-image @docker run --rm -it $(IMAGE_TAG) /bin/sh authzd-rpc-check: @go tool grpcurl -plaintext -format text -d '' 127.0.0.1:10003 envoy.service.auth.v3.Authorization.Check lint: @go tool yamlfmt --lint -exclude vendor . tidy: @go get -u ./... @go mod tidy @go mod vendor @go tool yamlfmt -exclude vendor .