forked from openfga/openfga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (46 loc) · 1.51 KB
/
Makefile
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
.DEFAULT_GOAL := help
COVERPKG := $(shell eval go list ./... | grep -v mocks | paste -sd "," -)
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: download
download:
@cd tools/ && go mod download
.PHONY: install-tools
install-tools: download ## Install developer tooling
@cd tools && go list -f '{{range .Imports}}{{.}} {{end}}' tools.go | CGO_ENABLED=0 xargs go install -mod=readonly
.PHONY: lint
lint: ## Lint Go source files
@golangci-lint run
.PHONY: clean
clean: ## Clean files
rm ./bin/openfga
.PHONY: build
build: ## Build/compile the OpenFGA service
go build -o ./bin/openfga ./cmd/openfga
.PHONY: run
run: build ## Run the OpenFGA server with in-memory storage
./bin/openfga run
.PHONY: run-postgres
run-postgres: build ## Run the OpenFGA server with Postgres storage
docker-compose down
docker-compose up -d postgres
$(test_backend) make run
.PHONY: go-generate
go-generate: install-tools
go generate ./...
.PHONY: unit-test
unit-test: go-generate ## Run unit tests
go test $(gotest_extra_flags) -v \
-coverprofile=coverageunit.out \
-coverpkg=$(COVERPKG) \
-covermode=atomic -race \
-count=1 \
./...
.PHONY: bench
bench: go-generate
go test ./... -bench=. -run=XXX -benchmem
.PHONY: initialize-db
initialize-db: go-generate
#TODO wait for docker postgres container to be healthy
go clean -testcache; $(test_backend) go test ./storage/postgres -run TestReadTypeDefinition; \