summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile37
1 files changed, 20 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 0e97fcd..467479a 100644
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,9 @@ PROJECT_NAME := $(shell basename $(shell pwd))
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed 's/\//_/g')
IMAGE_TAG := $(PROJECT_NAME):$(GIT_BRANCH)
AUTHZD_BIN := bin/authzd
+DOCKER := docker
+GO := mise exec go -- go
+MISE := bin/mise
SPARKLED_BIN := bin/sparkled
SPICEDB := bin/spicedb
TOOL := bin/tool
@@ -10,24 +13,24 @@ ZED := bin/zed
.PHONY: clean setup build test run db-setup db-create db-stop db-reset
$(AUTHZD_BIN): $(shell find . -name "*.go" 2>/dev/null) go.sum
- @go build -o $(AUTHZD_BIN) ./cmd/authzd/main.go
+ @$(GO) build -mod=vendor -o $(AUTHZD_BIN) ./cmd/authzd/main.go
$(SPARKLED_BIN): $(shell find . -name "*.go" 2>/dev/null) go.sum
- @go build -o $(SPARKLED_BIN) ./cmd/sparkled/main.go
+ @$(GO) build -mod=vendor -o $(SPARKLED_BIN) ./cmd/sparkled/main.go
db-clean:
@rm -rf tmp/postgres tmp/postgres.log
clean: db-clean
@rm -f $(AUTHZD_BIN) $(SPARKLED_BIN) Procfile Procfile.dev
- @go clean -testcache
+ @$(GO) clean -testcache
setup:
- @mise install
+ @$(MISE) install
@if command -v brew >/dev/null 2>&1; then \
brew bundle; \
fi
- @mise exec python -- pip install dumb-init
+ @$(MISE) exec python -- pip install dumb-init
Procfile: Procfile.template
@grep -v "# DEV_ONLY:" Procfile.template > Procfile
@@ -41,31 +44,31 @@ test-schema:
@$(ZED) validate etc/authzd/*.yaml
test-unit:
- @go test -shuffle=on ./...
+ @$(GO) test -shuffle=on ./...
test-race:
- @CGO_ENABLED=1 go test -race -shuffle=on ./...
+ @CGO_ENABLED=1 $(GO) test -race -shuffle=on ./...
test-integration: build-image
- @IMAGE_TAG=$(IMAGE_TAG) go test -tags=integration ./test/integration/...
+ @IMAGE_TAG=$(IMAGE_TAG) $(GO) test -tags=integration ./test/integration/...
-test: clean test-unit test-schema test-integration
+test: clean test-unit test-race test-integration test-schema
build-image: Procfile
- @docker build --network=host --no-cache --tag $(IMAGE_TAG) .
+ @$(DOCKER) build --network=host --tag $(IMAGE_TAG) .
run: clean build Procfile.dev db-init
@$(TOOL) godotenv -f .env.local,.env $(TOOL) minit -f Procfile.dev
run-image: clean build-image
- @docker run --rm --network host --env-file .env.local -p 10000:10000 -it $(IMAGE_TAG)
+ @$(DOCKER) run --rm --network host --env-file .env.local -p 10000:10000 -it $(IMAGE_TAG)
lint:
@$(TOOL) yamlfmt -lint -exclude vendor .
@$(ZED) validate etc/authzd/*
tidy:
- @go mod tidy
+ @$(GO) mod tidy
@$(TOOL) yamlfmt -exclude vendor .
db-schema-load:
@@ -75,20 +78,20 @@ db-seed:
@$(ZED) import etc/authzd/relationships.yaml
db-stop:
- @mise exec postgres -- pg_ctl -D tmp/postgres stop || true
+ @$(MISE) exec postgres -- pg_ctl -D tmp/postgres stop || true
db-reset: db-stop db-clean db-create
db-init:
- @[ ! -d tmp/postgres ] && mise exec postgres -- initdb -D tmp/postgres || true
+ @[ ! -d tmp/postgres ] && $(MISE) exec postgres -- initdb -D tmp/postgres || true
db-create: db-init
- @mise exec postgres -- createdb -h /tmp sparkle_development || true
+ @$(MISE) exec postgres -- createdb -h /tmp sparkle_development || true
db-migrate:
@$(TOOL) godotenv -f .env.local,.env -- sh -c '$(SPICEDB) datastore migrate head --datastore-engine postgres --datastore-conn-uri "$$DATABASE_URL" --log-level trace' --skip-release-check
db-console:
- @mise exec postgres -- psql -h /tmp sparkle_development
+ @$(MISE) exec postgres -- psql -h /tmp sparkle_development
-db-setup: db-create db-schema-load db-seed
+db-setup: db-create # db-schema-load db-seed