mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
feat(version): Makefile and version enhancement
Make to run go test for executing unit test cases. Removed version file, now if travis tag is set, the VERSION will be set to that tag. And if travis tag is not set, the driver version will be set to <branch-name>:<short commit hash>:<build date> Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
4c47dcf0f5
commit
1c9ee3102a
3 changed files with 22 additions and 4 deletions
6
Makefile
6
Makefile
|
|
@ -1,6 +1,8 @@
|
||||||
# list only csi source code directories
|
# list only csi source code directories
|
||||||
PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated')
|
PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated')
|
||||||
|
|
||||||
|
UNIT_TEST_PACKAGES = $(shell go list ./... | grep -v 'vendor\|pkg/generated\|tests')
|
||||||
|
|
||||||
# Lint our code. Reference: https://golang.org/cmd/vet/
|
# Lint our code. Reference: https://golang.org/cmd/vet/
|
||||||
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
|
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods \
|
||||||
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
|
-nilfunc -printf -rangeloops -shift -structtags -unsafeptr
|
||||||
|
|
@ -36,7 +38,7 @@ CSI_DRIVER=zfs-driver
|
||||||
BUILD_DATE = $(shell date +'%Y%m%d%H%M%S')
|
BUILD_DATE = $(shell date +'%Y%m%d%H%M%S')
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: zfs-driver-image
|
all: test zfs-driver-image
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
|
|
@ -54,7 +56,7 @@ format:
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: format
|
test: format
|
||||||
@echo "--> Running go test" ;
|
@echo "--> Running go test" ;
|
||||||
@go test $(PACKAGES)
|
@go test $(UNIT_TEST_PACKAGES)
|
||||||
|
|
||||||
# Bootstrap downloads tools required
|
# Bootstrap downloads tools required
|
||||||
# during build
|
# during build
|
||||||
|
|
|
||||||
1
VERSION
1
VERSION
|
|
@ -1 +0,0 @@
|
||||||
0.5.0
|
|
||||||
|
|
@ -24,8 +24,25 @@ if [[ -n "$TRAVIS_TAG" ]] && [[ $TRAVIS_TAG != *"RC"* ]]; then
|
||||||
echo "released" > BUILDMETA
|
echo "released" > BUILDMETA
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CURRENT_BRANCH=""
|
||||||
|
if [ -z ${TRAVIS_BRANCH} ];
|
||||||
|
then
|
||||||
|
CURRENT_BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
|
||||||
|
else
|
||||||
|
CURRENT_BRANCH=${TRAVIS_BRANCH}
|
||||||
|
fi
|
||||||
|
|
||||||
# Get the version details
|
# Get the version details
|
||||||
VERSION="$(cat $GOPATH/src/github.com/openebs/zfs-localpv/VERSION)"
|
if [ -n "$TRAVIS_TAG" ]; then
|
||||||
|
VERSION="$(git describe --tags `git rev-list --tags --max-count=1`)"
|
||||||
|
else
|
||||||
|
BUILDDATE=`date +%m-%d-%Y`
|
||||||
|
SHORT_COMMIT="$(git rev-parse --short HEAD)"
|
||||||
|
VERSION="$CURRENT_BRANCH-$SHORT_COMMIT:$BUILDDATE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "\nbuilding the ZFS Driver version :- $VERSION\n"
|
||||||
|
|
||||||
VERSION_META="$(cat $GOPATH/src/github.com/openebs/zfs-localpv/BUILDMETA)"
|
VERSION_META="$(cat $GOPATH/src/github.com/openebs/zfs-localpv/BUILDMETA)"
|
||||||
|
|
||||||
# Determine the arch/os combos we're building for
|
# Determine the arch/os combos we're building for
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue