-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
33 lines (23 loc) · 1.11 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
VERSION ?= "unknown"
VERSION_FLAG := -X github.com/nunnatsa/ginkgolinter/version.version=$(VERSION)
COMMIT_HASH := $(shell git rev-parse HEAD)
HASH_FLAG := -X github.com/nunnatsa/ginkgolinter/version.gitHash=$(COMMIT_HASH)
BUILD_ARGS := -ldflags "$(VERSION_FLAG) $(HASH_FLAG)"
build: goimports
go build $(BUILD_ARGS) -o ginkgolinter ./cmd/ginkgolinter
unit-test:
go test ./...
build-for-windows:
GOOS=windows GOARCH=amd64 go build $(BUILD_ARGS) -o bin/ginkgolinter-amd64.exe ./cmd/ginkgolinter
build-for-mac:
GOOS=darwin GOARCH=amd64 go build $(BUILD_ARGS) -o bin/ginkgolinter-amd64-darwin ./cmd/ginkgolinter
build-for-linux:
GOOS=linux GOARCH=amd64 go build $(BUILD_ARGS) -o bin/ginkgolinter-amd64-linux ./cmd/ginkgolinter
GOOS=linux GOARCH=386 go build $(BUILD_ARGS) -o bin/ginkgolinter-386-linux ./cmd/ginkgolinter
build-all: build build-for-linux build-for-mac build-for-windows
test-cli:
cd tests; go test -v ./
test: unit-test test-cli
goimports:
go install golang.org/x/tools/cmd/goimports@latest
goimports -w -local="github.com/nunnatsa/ginkgolinter" $(shell find . -type f -name '*.go' ! -path "*/vendor/*")