summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile53
1 files changed, 42 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 028279a6..a134ae64 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,42 @@
-default: install-tools
- @mage -l
-
-install-tools:
- @cargo install --keep-going cedar-policy-cli
- @go install tool
- @command -v cedar
- @command -v mage
- @command -v protoc-gen-go
- @command -v protoc-gen-go-grpc
- @command -v protoc-gen-twirp_ruby
+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
+.PHONY: build-image run-image health-check list-services test-grpc
+
+# Cargo targets
+build:
+ @cargo build
+
+check:
+ @cargo check
+
+test:
+ @cargo test
+
+run:
+ @cargo run
+
+clean:
+ @cargo clean
+
+fmt:
+ @cargo fmt
+
+lint:
+ @cargo clippy -- -D warnings
+
+doc:
+ @cargo doc --open
+
+# Docker targets
+build-image:
+ @docker build --no-cache --tag $(IMAGE_TAG) .
+
+run-image: build-image
+ @docker run --rm -p 50051:50051 -it $(IMAGE_TAG)
+
+# gRPC testing targets
+health-check:
+ @grpcurl -plaintext localhost:50051 grpc.health.v1.Health/Check