You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ncdns/.travis/script

82 lines
2.1 KiB
Bash

#!/bin/bash
travis_retry go get github.com/tcnksm/ghr github.com/mitchellh/gox gopkg.in/alecthomas/gometalinter.v1
go test -v ./...
RESULT=$?
echo Done tests with exit code $RESULT
if [ "$RESULT" != "0" ]; then
return $RESULT
fi
# Static analysis
gometalinter.v1 --install
echo ""
echo "gometalinter critical (should be no warnings):"
gometalinter.v1 --enable-all \
--disable=aligncheck \
--disable=deadcode \
--disable=dupl \
--disable=errcheck \
--disable=gas \
--disable=gocyclo \
--disable=gofmt \
--disable=goimports \
--disable=golint \
--disable=gosimple \
--disable=gotype \
--disable=ineffassign \
--disable=lll \
--disable=misspell \
--disable=staticcheck \
--disable=unconvert \
--disable=unparam \
--disable=unused \
--concurrency=3 \
--deadline=10m \
./...
STATICRESULT1=$?
echo ""
echo "gometalinter non-critical (warnings expected):"
gometalinter.v1 --enable-all \
--concurrency=3 \
--deadline=10m \
./...
STATICRESULT2=$?
# Test cross-compilation. The binaries produced are also used for release
# upload in after_success if this is a release tag.
echo Cross-compiling releases...
mkdir -p "$GOPATH/releasing/idist" "$GOPATH/releasing/dist"
GOX_PARA=15
# cgo crosscompile
REPOS="github.com/$TRAVIS_REPO_SLUG/..."
gox -parallel=$GOX_PARA -cgo -osarch 'linux/386 linux/amd64' -output "$GOPATH/releasing/idist/ncdns-$TRAVIS_TAG-{{.OS}}_{{.Arch}}/bin/{{.Dir}}" $REPOS
RESULT1=$?
# non-cgo crosscompile
gox -parallel=$GOX_PARA -osarch 'darwin/386 darwin/amd64 linux/arm linux/arm64 linux/ppc64 linux/ppc64le freebsd/386 freebsd/amd64 freebsd/arm openbsd/386 openbsd/amd64 netbsd/386 netbsd/amd64 netbsd/arm dragonfly/amd64 solaris/amd64 windows/386 windows/amd64' -output "$GOPATH/releasing/idist/ncdns-$TRAVIS_TAG-{{.OS}}_{{.Arch}}/bin/{{.Dir}}" $REPOS
RESULT2=$?
echo cgo crosscompile exited with code $RESULT1
echo non-cgo crosscompile exited with code $RESULT2
echo critical gometalinter exited with code $STATICRESULT1
echo non-critical gometalinter exited with code $STATICRESULT2
if [ "$RESULT1" != "0" ]; then
return $RESULT1
fi
if [ "$RESULT2" != "0" ]; then
return $RESULT2
fi
if [ "$STATICRESULT1" != "0" ]; then
return $STATICRESULT1
fi