-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
46 lines (38 loc) · 1.12 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
PROJECT := in-toto-container
ORG := engineerd
BINDIR := $(CURDIR)/bin
GOFLAGS :=
LDFLAGS := -w -s
TARGET_NAME := itc
ifeq ($(OS),Windows_NT)
TARGET = $(TARGET_NAME).exe
SHELL = cmd.exe
CHECK = where.exe
else
TARGET = $(TARGET_NAME)
SHELL ?= bash
CHECK ?= which
endif
.PHONY: build
build:
go build $(GOFLAGS) -ldflags '$(LDFLAGS)' -o $(BINDIR)/$(TARGET) github.com/$(ORG)/$(PROJECT)/cmd/...
.PHONY: test
test:
go test $(TESTFLAGS) ./... -v
.PHONY: e2e
e2e:
$(BINDIR)/$(TARGET) verify --layout testdata/intoto/demo.layout.template --layout-key testdata/intoto/alice.pub --links testdata/intoto/ --target testdata/intoto/foo.tar.gz
.PHONY: lint
lint:
golangci-lint run --config ./golangci.yml
HAS_GOLANGCI := $(shell $(CHECK) golangci-lint)
HAS_GOIMPORTS := $(shell $(CHECK) goimports)
GOLANGCI_VERSION := v1.16.0
.PHONY: bootstrap
bootstrap:
ifndef HAS_GOLANGCI
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_VERSION)
endif
ifndef HAS_GOIMPORTS
go get -u golang.org/x/tools/cmd/goimports
endif