-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
111 lines (88 loc) · 3.13 KB
/
Copy pathMakefile
File metadata and controls
111 lines (88 loc) · 3.13 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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.25.10-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/containous/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-vm: $(SOURCES) templates/templates.go
docker build \
--network=host \
--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:local .
docker-dbg: $(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.debug -t arangodb/testagent:dbg .
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 github.com/arangodb-helper/testagent/tests/complex -v
go tool cover -html=cover.out
docker-push-version: docker
docker tag arangodb/testagent arangodb/testagent:$(VERSION)
docker push arangodb/testagent:$(VERSION)
docker-push-version-latest: docker
docker tag arangodb/testagent arangodb/testagent:$(VERSION)
docker tag arangodb/testagent:$(VERSION) arangodb/testagent:latest
docker push arangodb/testagent:$(VERSION)
docker push arangodb/testagent:latest
release-patch:
go run ./tools/release.go -type=patch -latest
release-minor:
go run ./tools/release.go -type=minor -latest
release-major:
go run ./tools/release.go -type=major -latest
release-patch-legacy:
go run ./tools/release.go -type=patch