-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (33 loc) · 1.03 KB
/
Makefile
File metadata and controls
39 lines (33 loc) · 1.03 KB
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
GO ?= go
CUE ?= cue
GOCI ?= golangci-lint
GOFMT ?= $(GO)fmt
.PHONY: checkformat
checkformat:
@echo ">> Check Go code format"
! $(GOFMT) -d $$(find . -name '*.go' -not -path "./ui/*" -print) | grep '^'
.PHONY: checkunused
checkunused:
@echo ">> Check for unused/missing packages in go.mod"
$(GO) mod tidy
@git diff --exit-code -- go.sum go.mod
.PHONY: checkstyle
checkstyle:
@echo ">> Check Go code style"
$(GOCI) run --timeout 5m
.PHONY: go-test
go-test:
@echo ">> Run all go tests"
$(GO) test -count=1 -v ./...
.PHONY: cue-eval
cue-eval:
@echo ">> Validate CUE schemas"
cd cue && $(CUE) eval ./...
.PHONY: cue-gen
cue-gen:
@echo ">> Generate CUE definitions from golang datamodel"
@for pkg in $$($(GO) list github.com/perses/spec/go/...); do \
$(CUE) get go $$pkg; \
done
cp -r cue.mod/gen/github.com/perses/spec/go/* cue/ && rm -r cue.mod/gen
find cue/ -name "*.cue" -exec sed -i 's/\"github.com\/perses\/spec\/go/\"github.com\/perses\/spec\/cue/g' {} \;