-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (45 loc) · 1.69 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
NAME := pkgs-checker
PACKAGE_NAME ?= $(NAME)
REVISION := $(shell git rev-parse --short HEAD || echo dev)
VERSION := $(shell git describe --tags || echo $(REVISION))
VERSION := $(shell echo $(VERSION) | sed -e 's/^v//g')
BUILD_PLATFORMS ?= -osarch="linux/amd64" -osarch="linux/386" -osarch="linux/arm"
# go tool nm ./luet | grep Commit
override LDFLAGS += -X "github.com/Sabayon/pkgs-checker/cmd.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %Z')"
override LDFLAGS += -X "github.com/Sabayon/pkgs-checker/cmd.BuildCommit=$(shell git rev-parse HEAD)"
.PHONY: all
all: pkgs-checker
.PHONY: pkgs-checker
pkgs-checker:
# pkgs-checker uses go-sqlite3 that require CGO
CGO_ENABLED=1 go build -ldflags '$(LDFLAGS)'
.PHONY: test
test:
go test -v -tags all -cover -race ./...
#go test -v -tags all -cover -race ./... -ginkgo.v
.PHONY: coverage
coverage:
go test ./... -race -coverprofile=coverage.txt -covermode=atomic
.PHONY: test-coverage
test-coverage:
scripts/ginkgo.coverage.sh --codecov
.PHONY: clean
clean:
-rm pkgs-checker
-rm -rf release/ dist/
.PHONY: deps
deps:
go env
# Installing dependencies...
GO111MODULE=off go get golang.org/x/lint/golint
GO111MODULE=off go get github.com/mitchellh/gox
GO111MODULE=off go get golang.org/x/tools/cmd/cover
GO111MODULE=off go get github.com/onsi/ginkgo/ginkgo
GO111MODULE=off go get github.com/onsi/gomega/...
.PHONY: goreleaser-snapshot
goreleaser-snapshot:
rm -rf dist/ || true
goreleaser release --debug --skip-publish --skip-validate --snapshot
.PHONY: multiarch-build-dev
multiarch-build-dev: deps
CGO_ENABLED=1 gox $(BUILD_PLATFORMS) -output="release/$(NAME)-$(REVISION)-{{.OS}}-{{.Arch}}" -ldflags "$(LDFLAGS) -extldflags=-Wl,--allow-multiple-definition"