forked from salesforce/sloop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (38 loc) · 1.3 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
.PHONY:all run linux docker generate tidy protobuf cover docker-push
all:
go get ./pkg/...
go fmt ./pkg/...
go install ./pkg/...
go test -cover ./pkg/...
run:
go install ./pkg/...
$(GOPATH)/bin/sloop
linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go install -ldflags "-s" -installsuffix cgo -v ./pkg/...
goreleaser:
@if [ ! -f "$(GOPATH)/bin/goreleaser" ];then \
curl -sfL https://install.goreleaser.com/github.com/goreleaser/goreleaser.sh | sh -s -- -b "$(GOPATH)/bin/"; \
fi
docker-snapshot: goreleaser
$(GOPATH)/bin/goreleaser release --snapshot --rm-dist
docker: goreleaser
$(GOPATH)/bin/goreleaser release --rm-dist --skip-publish
generate:
go generate ./pkg/...
tidy:
# Run tidy whenever go.mod is changed
go mod tidy
protobuf:
# Make sure you `brew install protobuf` first
# go get -u github.com/golang/protobuf/protoc-gen-go
protoc -I=./pkg/sloop/store/typed/ --go_out=./pkg/sloop/store/typed/ ./pkg/sloop/store/typed/schema.proto
cover:
go test ./pkg/... -coverprofile=coverage.out
go tool cover -html=coverage.out
release:
@if [ ! -z "$(GITHUB_TOKEN)" ];then \
curl -sfL https://git.io/goreleaser | sh -s -- release --rm-dist;\
else \
curl -sfL https://git.io/goreleaser | sh -s -- release --rm-dist --skip-publish && \
docker push sloopimage/sloop;\
fi