-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
79 lines (60 loc) · 2.03 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
PROJECT := testAgent
SCRIPTDIR := $(shell pwd)
ROOTDIR := $(shell cd $(SCRIPTDIR) && pwd)
VERSION:= $(shell cat $(ROOTDIR)/VERSION)
COMMIT := $(shell git rev-parse --short HEAD)
SRCDIR := $(SCRIPTDIR)
BINDIR := $(ROOTDIR)/bin
ORGPATH := github.com/arangodb-helper
REPONAME := $(PROJECT)
REPOPATH := $(ORGPATH)/$(REPONAME)
GOVERSION := 1.15-alpine
ifndef GOOS
GOOS := linux
endif
ifndef GOARCH
GOARCH := amd64
endif
ifndef DOCKERNAMESPACE
DOCKERNAMESPACE := arangodb
endif
BINNAME := testAgent-$(GOOS)-$(GOARCH)
BIN := $(BINDIR)/$(BINNAME)
SOURCES := $(shell find $(SRCDIR) -name '*.go')
TEMPLATES := $(shell find $(SRCDIR)/templates -name '*.tmpl')
.PHONY: all clean deps docker build build-local tests
all: docker
clean:
rm -Rf $(BIN)
templates/templates.go: $(TEMPLATES)
go build -o bin/go-bindata github.com/jteeuwen/go-bindata/go-bindata
bin/go-bindata -pkg templates -prefix templates -modtime 1486974991 -ignore templates.go -o templates/templates.go templates/...
docker: $(SOURCES) templates/templates.go
docker build \
--build-arg GOVERSION=$(GOVERSION) \
--build-arg GOOS="$(GOOS)" \
--build-arg GOARCH="$(GOARCH)" \
--build-arg BINNAME="$(BINNAME)" \
--build-arg GOTAGS="$(GOTAGS)" \
--build-arg VERSION="$(VERSION)" \
--build-arg COMMIT="$(COMMIT)" \
-f Dockerfile -t arangodb/testagent .
docker-push: docker
ifneq ($(DOCKERNAMESPACE), arangodb)
docker tag arangodb/testagent $(DOCKERNAMESPACE)/testagent
endif
docker push $(DOCKERNAMESPACE)/testagent
localtest:
docker run -it --rm --net=host -v $(HOME)/tmp:/reports -v /var/run/docker.sock:/var/run/docker.sock arangodb/testagent --docker-net-host
tests:
go test -coverprofile cover.out github.com/arangodb-helper/testagent/tests/simple -v
go tool cover -html=cover.out
docker-push-version: docker
docker tag arangodb/testagent arangodb/testagent:$(VERSION)
docker push arangodb/testagent:$(VERSION)
release-patch:
go run ./tools/release.go -type=patch
release-minor:
go run ./tools/release.go -type=minor
release-major:
go run ./tools/release.go -type=major