gotop/ci/script.sh

37 lines
702 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2019-02-08 11:04:51 +08:00
function main {
# Check if any command failed
ERROR=false
2019-02-08 11:04:51 +08:00
GOARCH=${_GOARCH}
GOOS=${_GOOS}
2019-02-08 11:04:51 +08:00
if [[ ! ${GOARCH} ]]; then
exit
fi
2019-02-08 11:04:51 +08:00
env GOOS=${GOOS} GOARCH=${GOARCH} GOARM=${GOARM} go build -o ${NAME} || ERROR=true
2019-02-08 11:04:51 +08:00
mkdir -p dist
2019-02-08 11:04:51 +08:00
if [[ ${GOARCH} == "arm64" ]]; then
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_arm8
else
FILE=${NAME}_${TRAVIS_BRANCH}_${GOOS}_${GOARCH}${GOARM}
fi
2019-02-08 11:04:51 +08:00
tar -czf dist/${FILE}.tgz ${NAME} || ERROR=true
2019-02-08 11:04:51 +08:00
if [[ ${GOOS} == "linux" && ${GOARCH} == "amd64" ]]; then
make all || ERROR=true
rm dist/gotop
fi
2019-02-08 11:04:51 +08:00
if [ ${ERROR} == "true" ]; then
exit 1
fi
}
main