forked from canonical/identity-platform-admin-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (48 loc) · 1.29 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
GO111MODULE?=on
CGO_ENABLED?=0
GOOS?=linux
GO_BIN?=app
GO?=go
GOFLAGS?=-ldflags=-w -ldflags=-s -a -buildvcs
UI_FOLDER?=
MICROK8S_REGISTRY_FLAG?=SKAFFOLD_DEFAULT_REPO=localhost:32000
SKAFFOLD?=skaffold
CONFIGMAP?=deployments/kubectl/configMap.yaml
.EXPORT_ALL_VARIABLES:
mocks: vendor
$(GO) install go.uber.org/mock/[email protected]
# 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/
npm-build:
$(MAKE) -C ui/ build
.PHONY: npm-build
dev:
@$(MICROK8S_REGISTRY_FLAG) $(SKAFFOLD) run \
--mute-logs=all \
--port-forward \
--no-prune=false \
--cache-artifacts=false
.PHONY: dev