Skip to content

Commit

Permalink
Merge pull request #116 from prateekpandey14/fix-travis-build
Browse files Browse the repository at this point in the history
Fix travis build process
  • Loading branch information
Amit Kumar Das authored Oct 17, 2017
2 parents 8d3e0b9 + 3fdf2d5 commit 1bfbd09
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 32 deletions.
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ go:
install:
- make bootstrap
script:
- make test bin
- ls -la bin/
- make all
- ./buildscripts/test-cov.sh
after_success:
- bash <(curl -s https://codecov.io/bash)
- make image
notifications:
email:
recipients:
Expand All @@ -24,12 +22,14 @@ deploy:
api_key:
secure: na/NPsgDHGGRaWxRSCo5gH3TPrEutNvhEK3q2k99bbW2INe0FZ+FIPeuL9rqV8eCQi8SWJGHNFjFyMRR798RRSn8bdiK0pxJXzYvphUEH2Azzoqr65TaJHpHNTkv1WTK9OtgahT71MbmIx777U6Vd6ylyJyWja+LPhY/z66XOYQmuXR2ds7FRBlAcWg8C0KIFTLYlms5C9RKwLS2jP5C8tlJBQXMDEk7ejR1mKn3R6KQyyHICGKPGhNE+d7iMs0qhhuGIhcDwXl1olChAAITOGyWEmjc2GeUbFALo8OXdQx9qBO7saw75IzyYV/itBjE0RpuM90jKuFzKGiotSyw7Fs0KgrjHC7keuaNMqBWgKl6qoAj2a5VVEBtx8k941hRLs/VpjQ+K8wJJpjlSR8vh906b8e+HL8BKJEifF09fKBTLd0AWy9I3x6TolmRqiamvIHEkup1fZqblhhe2ZLvwuuyfl3t1FTkkon5BASgSqFdBAhR3eAD/LOtrghjaRX7wCZCzKDEaS9QLeu9UbC+bmnaOo60Gaeyp/DN5FLc4cV/vZozroesu+UEtQIrC6VDlFNYfY0V1ETKpfEQ4I8yByDHx/KjMWDyUGd8e5tm0qsD1lW1yVekh5CjQRHpzShkmKvFieeVfqVy/aGB4GrTeWSxcKiN8W0ekcgCRYut6y0=
file_glob: true
file: bin/maya-linux_*.zip
file:
- bin/maya/maya-linux_*.zip
- bin/apiserver/maya-apiserver-linux_*.zip
skip_cleanup: true
overwrite: true
overwrite: true
on:
repo: openebs/maya
tags: true
branches:
except:
- /^*-v[0-9]/
- /^*-v[0-9]/
28 changes: 14 additions & 14 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ APISERVER=maya-apiserver
# Specify the date o build
BUILD_DATE = $(shell date +'%Y%m%d%H%M%S')

all: test
all: test mayactl apiserver

dev: format
@MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/build.sh'"
@MAYACTL=${MAYACTL} MAYA_DEV=1 sh -c "'$(PWD)/buildscripts/mayactl/build.sh'"

bin:
mayactl:
@echo "----------------------------"
@echo "--> maya "
@echo "----------------------------"
@MAYACTL=${MAYACTL} sh -c "'$(PWD)/buildscripts/build.sh'"
@MAYACTL=${MAYACTL} sh -c "'$(PWD)/buildscripts/mayactl/build.sh'"

initialize: bootstrap

Expand Down Expand Up @@ -86,15 +86,15 @@ bootstrap:
go get $$tool; \
done

image:
@cp bin/${MAYACTL} buildscripts/docker/
@cd buildscripts/docker && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} .
@rm buildscripts/docker/${MAYACTL}
@sh buildscripts/push
maya-image:
@cp bin/maya/${MAYACTL} buildscripts/mayactl/
@cd buildscripts/mayactl && sudo docker build -t openebs/maya:ci --build-arg BUILD_DATE=${BUILD_DATE} .
@rm buildscripts/mayactl/${MAYACTL}
@sh buildscripts/mayactl/push

# You might need to use sudo
install: bin/${MAYACTL}
install -o root -g root -m 0755 ./bin/${MAYACTL} /usr/local/bin/${MAYACTL}
install: bin/maya/${MAYACTL}
install -o root -g root -m 0755 ./bin/maya/${MAYACTL} /usr/local/bin/${MAYACTL}

# Use this to build only the maya-agent.
maya-agent:
Expand All @@ -109,15 +109,15 @@ apiserver:

# Currently both mayactl & apiserver binaries are pushed into
# m-apiserver image. This is going to be decoupled soon.
apiserver-image: bin apiserver
apiserver-image: mayactl apiserver
@echo "----------------------------"
@echo "--> apiserver image "
@echo "----------------------------"
@cp bin/apiserver/${APISERVER} buildscripts/apiserver/
@cp bin/${MAYACTL} buildscripts/apiserver/
@cp bin/maya/${MAYACTL} buildscripts/apiserver/
@cd buildscripts/apiserver && sudo docker build -t openebs/m-apiserver:ci --build-arg BUILD_DATE=${BUILD_DATE} .
@rm buildscripts/apiserver/${APISERVER}
@rm buildscripts/apiserver/${MAYACTL}
@sh buildscripts/apiserver/push

.PHONY: all bin cov integ test vet maya-agent test-nodep apiserver apiserver-image
.PHONY: all bin cov integ test vet maya-agent test-nodep apiserver apiserver-image maya-image
1 change: 0 additions & 1 deletion buildscripts/apiserver/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ do
if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
echo $GOARCH
env GOOS=$GOOS GOARCH=$GOARCH go build -ldflags \
"-X main.GitCommit='${GIT_COMMIT}${GIT_DIRTY}' \
-X main.CtlName='${CTLNAME}' \
Expand Down
File renamed without changes.
21 changes: 10 additions & 11 deletions buildscripts/build.sh → buildscripts/mayactl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -e
# Get the parent directory of where this script is.
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ] ; do SOURCE="$(readlink "$SOURCE")"; done
DIR="$( cd -P "$( dirname "$SOURCE" )/.." && pwd )"
DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )"

# Change into that directory
cd "$DIR"
Expand All @@ -28,15 +28,15 @@ XC_OSS=(${XC_OS// / })

# Delete the old dir
echo "==> Removing old directory..."
rm -rf bin/*
mkdir -p bin/
rm -rf bin/maya/*
mkdir -p bin/maya/

if [ -z "${GIT_TAG}" ];
if [ -z "${GIT_TAG}" ];
then
GIT_TAG="0.0.1"
fi

if [ -z "${MAYACTL}" ];
if [ -z "${MAYACTL}" ];
then
MAYACTL="mayactl"
fi
Expand All @@ -54,12 +54,11 @@ for GOOS in "${XC_OSS[@]}"
do
for GOARCH in "${XC_ARCHS[@]}"
do
output_name="bin/"$GOOS"_"$GOARCH"/"$MAYACTL
output_name="bin/maya/"$GOOS"_"$GOARCH"/"$MAYACTL

if [ $GOOS = "windows" ]; then
output_name+='.exe'
fi
echo $GOARCH
env GOOS=$GOOS GOARCH=$GOARCH go build -ldflags \
"-X main.GitCommit='${GIT_COMMIT}${GIT_DIRTY}' \
-X main.CtlName='${CTLNAME}' \
Expand All @@ -84,16 +83,16 @@ IFS=: MAIN_GOPATH=($GOPATH)
IFS=$OLDIFS

# Copy our OS/Arch to the bin/ directory
DEV_PLATFORM="./bin/$(go env GOOS)_$(go env GOARCH)"
DEV_PLATFORM="./bin/maya/$(go env GOOS)_$(go env GOARCH)"
for F in $(find ${DEV_PLATFORM} -mindepth 1 -maxdepth 1 -type f); do
cp ${F} bin/
cp ${F} bin/maya
cp ${F} ${MAIN_GOPATH}/bin/
done

if [[ "x${MAYA_DEV}" == "x" ]]; then
# Zip and copy to the dist dir
echo "==> Packaging..."
for PLATFORM in $(find ./bin -mindepth 1 -maxdepth 1 -type d); do
for PLATFORM in $(find ./bin/maya -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename ${PLATFORM})
echo "--> ${OSARCH}"

Expand All @@ -106,4 +105,4 @@ fi
# Done!
echo
echo "==> Results:"
ls -hl bin/
ls -hl bin/maya
File renamed without changes.

0 comments on commit 1bfbd09

Please sign in to comment.