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: build check test run clean fmt lint doc vendor .PHONY: build-image run-image .PHONY: health-check list-services setup: mise install mise exec go -- go install github.com/xlgmokha/minit@latest mise exec rust -- rustup component add clippy rustfmt rust-analyzer mise exec rust -- cargo install --locked cedar-policy-cli # Cargo targets build: @cargo build --offline check: @cargo check test: @cargo test run: build @cp target/debug/authzd bin/authzd @minit clean: @cargo clean fmt: @cargo fmt @for policy in etc/authzd/*.cedar; do cedar format --policies $$policy --write; done lint: @cargo clippy @for policy in etc/authzd/*.cedar; do cedar check-parse --policies $$policy; done @for policy in etc/authzd/*.cedar; do cedar format --policies $$policy --check; done doc: @cargo doc --open vendor: @cargo vendor # Docker targets build-image: @docker build --tag $(IMAGE_TAG) . run-image: build-image @docker run --rm -p 20000:20000 --init -it $(IMAGE_TAG) # HTTP and gRPC testing targets health-check: @grpcurl -plaintext localhost:20000 grpc.health.v1.Health/Check list-services: @grpcurl -plaintext localhost:20000 list # entities targets generate-staging-entities: @cargo run --bin cli -- generate --host https://staging.gitlab.com --project authorization/sparkle/team --output etc/authzd/staging.gitlab.com/authorization/sparkle/team/entities.json generate-production-entities: @cargo run --bin cli -- generate --project gitlab-org/gitlab --output etc/authzd/gitlab.com/gitlab-org/gitlab/entities.json @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/authzd --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/authzd/entities.json @cargo run --bin cli -- generate --project gitlab-org/software-supply-chain-security/authorization/sparkled --output etc/authzd/gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/entities.json