/
Makefile
60 lines (40 loc) · 1.78 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
.PHONY: build
PACKAGES = $(shell go list ./... | grep -v /vendor/)
DIRS = $(shell go list ./... | grep -v /vendor/ | sed 's~^github.com/mongoeye/mongoeye~.~' | grep -v '^.$$')
ci : get-deps coverage fmt-check lint
all: fmt-fix lint test build
get-deps:
ls ./bin/gometalinter || curl -L https://git.io/vp6lP | sh
go get github.com/kyoh86/richgo
go get github.com/mattn/goveralls
go get golang.org/x/lint/golint
go mod vendor
fmt-check:
gofmt -s -l main.go $(DIRS)
fmt-fix:
gofmt -s -l -w main.go $(DIRS)
lint:
golint -min_confidence 0.85 -set_exit_status $(DIRS)
test:
bash -c "_contrib/test.sh"
coverage:
bash -c "_contrib/coverage.sh"
benchmark:
go test -v -run=^$$ -bench=. -count=2 -benchtime=1s -benchmem -parallel=1 $(PACKAGES)
benchmark-stages:
go test -v -run=^$$ -bench=Full$$ -count=2 -benchtime=1s -benchmem -parallel=1 $(PACKAGES)
build: build-cross build-tar build-zip
build-cross:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o _release/mongoeye/linux/amd64/mongoeye github.com/mongoeye/mongoeye
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o _release/mongoeye/linux/arm64/mongoeye github.com/mongoeye/mongoeye
GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -o _release/mongoeye/linux/arm/mongoeye github.com/mongoeye/mongoeye
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o _release/mongoeye/windows/amd64/mongoeye.exe github.com/mongoeye/mongoeye
GOOS=darwin GOARCH=amd64 CGO_ENABLED=0 go build -o _release/mongoeye/darwin/amd64/mongoeye github.com/mongoeye/mongoeye
build-tar:
tar -cvzf _release/mongoeye.tar.gz -C _release mongoeye
build-zip:
cd _release; zip -r mongoeye.zip mongoeye
demo-gif:
bash -c "_contrib/demo/record-gif.sh"
demo-asciinema:
bash -c "asciinema rec -t 'Mongoeye demo' -y -c ./_contrib/demo/demo.sh"