File tree 5 files changed +90
-0
lines changed 5 files changed +90
-0
lines changed Original file line number Diff line number Diff line change
1
+ PROJDIR =$(dir $(realpath $(firstword $(MAKEFILE_LIST ) ) ) )
2
+
3
+ # change to project dir so we can express all as relative paths
4
+ $(shell cd $(PROJDIR))
5
+
6
+ PROJ =agola
7
+ ORG_PATH =github.com/sorintlab
8
+ REPO_PATH =$(ORG_PATH ) /$(PROJ )
9
+
10
+ VERSION ?= $(shell scripts/git-version.sh)
11
+
12
+ LD_FLAGS ="-w -X $(REPO_PATH ) /version.Version=$(VERSION ) "
13
+
14
+ $(shell mkdir -p bin )
15
+ $(shell mkdir -p tools/bin )
16
+
17
+ AGOLA_TAGS = sqlite_unlock_notify
18
+
19
+ .PHONY : all
20
+ all : build
21
+
22
+ .PHONY : build
23
+ build : bin/agola bin/agola-toolbox
24
+
25
+ .PHONY : test
26
+ test : tools/bin/gocovmerge
27
+ @scripts/test.sh
28
+
29
+ # don't use existing file names and track go sources, let's do this to the go tool
30
+ .PHONY : bin/agola
31
+ bin/agola :
32
+ GO111MODULE=on go build $(if $(AGOLA_TAGS ) ,-tags "$(AGOLA_TAGS ) ") -ldflags $(LD_FLAGS ) -o $(PROJDIR ) /bin/agola $(REPO_PATH ) /cmd/agola
33
+
34
+ # toolbox MUST be statically compiled so it can be used in any image for that arch
35
+ # TODO(sgotti) cross compile to multiple archs
36
+ .PHONY : bin/agola-toolbox
37
+ bin/agola-toolbox :
38
+ CGO_ENABLED=0 GO111MODULE=on go build $(if $(AGOLA_TAGS ) ,-tags "$(AGOLA_TAGS ) ") -ldflags $(LD_FLAGS ) -o $(PROJDIR ) /bin/agola-toolbox $(REPO_PATH ) /cmd/toolbox
39
+
40
+ .PHONY : tools/bin/gocovmerge
41
+ tools/bin/gocovmerge :
42
+ GOBIN=$(PROJDIR ) /tools/bin go install github.com/wadey/gocovmerge
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ require (
11
11
github.com/docker/docker v1.13.1
12
12
github.com/docker/go-connections v0.4.0 // indirect
13
13
github.com/docker/go-units v0.3.3 // indirect
14
+ github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 // indirect
15
+ github.com/go-bindata/go-bindata v1.0.0 // indirect
14
16
github.com/go-ini/ini v1.42.0 // indirect
15
17
github.com/go-sql-driver/mysql v1.4.1 // indirect
16
18
github.com/google/go-cmp v0.3.0
Original file line number Diff line number Diff line change @@ -32,13 +32,17 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh
32
32
github.com/docker/go-connections v0.4.0 /go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec =
33
33
github.com/docker/go-units v0.3.3 h1:Xk8S3Xj5sLGlG5g67hJmYMmUgXv5N4PhkjJHHqrwnTk =
34
34
github.com/docker/go-units v0.3.3 /go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk =
35
+ github.com/dsnet/compress v0.0.0-20171208185109-cc9eb1d7ad76 /go.mod h1:KjxHHirfLaw19iGT70HvVjHQsL1vq1SRQB4yOsAfy2s =
35
36
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs =
36
37
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 /go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk =
37
38
github.com/fatih/color v1.7.0 /go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4 =
38
39
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I =
39
40
github.com/fsnotify/fsnotify v1.4.7 /go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo =
40
41
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk =
41
42
github.com/ghodss/yaml v1.0.0 /go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04 =
43
+ github.com/go-bindata/go-bindata v1.0.0 h1:DZ34txDXWn1DyWa+vQf7V9ANc2ILTtrEjtlsdJRF26M =
44
+ github.com/go-bindata/go-bindata v1.0.0 /go.mod h1:xK8Dsgwmeed+BBsSy2XTopBn/8uK2HWuGSnA11C3Joo =
45
+ github.com/go-ini/ini v1.41.0 /go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8 =
42
46
github.com/go-ini/ini v1.42.0 h1:TWr1wGj35+UiWHlBA8er89seFXxzwFn11spilrrj+38 =
43
47
github.com/go-ini/ini v1.42.0 /go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8 =
44
48
github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA =
Original file line number Diff line number Diff line change
1
+ // Copyright 2019 Sorint.lab
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ // +build tools
16
+
17
+ package tools
18
+
19
+ import (
20
+ _ "github.com/go-bindata/go-bindata"
21
+ )
Original file line number Diff line number Diff line change
1
+ #! /bin/sh -e
2
+
3
+ # parse the current git commit hash
4
+ COMMIT=` git rev-parse HEAD`
5
+
6
+ # check if the current commit has a matching tag
7
+ TAG=$( git describe --exact-match --abbrev=0 --tags ${COMMIT} 2> /dev/null || true)
8
+
9
+ # use the matching tag as the version, if available
10
+ if [ -z " $TAG " ]; then
11
+ VERSION=$COMMIT
12
+ else
13
+ VERSION=$TAG
14
+ fi
15
+
16
+ # check for changed files (not untracked files)
17
+ if [ -n " $( git diff --shortstat 2> /dev/null | tail -n1) " ]; then
18
+ VERSION=" ${VERSION} -dirty"
19
+ fi
20
+
21
+ echo $VERSION
You can’t perform that action at this time.
0 commit comments