-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
59 lines (48 loc) · 1.43 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
59
GO111MODULE?=on
CGO_ENABLED?=0
GOOS?=linux
GO_BIN?=app
GO?=go
GOFLAGS?=-ldflags=-w -ldflags=-s -a -buildvcs
UI_FOLDER?=
.EXPORT_ALL_VARIABLES:
mocks: vendor
$(GO) install go.uber.org/mock/mockgen@v0.3.0
# generate gomocks
$(GO) generate ./...
.PHONY: mocks
test: mocks vet
$(GO) test ./... -cover -coverprofile coverage_source.out
# this will be cached, just needed to the test.json
$(GO) test ./... -cover -coverprofile coverage_source.out -json > test_source.json
cat coverage_source.out | grep -v "mock_*" | tee coverage.out
cat test_source.json | grep -v "mock_*" | tee test.json
.PHONY: test
vet: cmd/ui/dist
$(GO) vet ./...
.PHONY: vet
vendor:
$(GO) mod vendor
.PHONY: vendor
build: cmd/ui/dist
$(GO) build -o $(GO_BIN) ./
.PHONY: build
# plan is to use this as a probe, if folder is there target wont run and npm-build will skip
# but not working atm
cmd/ui/dist:
@echo "copy dist npm files into cmd/ui folder"
mkdir -p cmd/ui/dist
cp -r $(UI_FOLDER)ui/dist cmd/ui/
.PHONY: cmd/ui/dist
npm-build:
$(MAKE) -C ui/ build
.PHONY: npm-build
update-openfga-model:
@printf 'package authorization\n\n// Code generated by Makefile; DO NOT EDIT.\n\nvar AuthModel = `%s`\n' '$(shell fga model transform --file=./internal/authorization/schema.openfga | jq -c)' > ./internal/authorization/auth_model.go
.PHONY: update-openfga-model
test-e2e:
$(MAKE) -C ui/ test-e2e
.PHONY: test-e2e
test-e2e-debug:
$(MAKE) -C ui/ test-e2e-debug
.PHONY: test-e2e