2018-03-14 17:05:24 +09:00
|
|
|
language: go
|
|
|
|
# see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments
|
|
|
|
# for the detail
|
|
|
|
# sudo: requried
|
|
|
|
dist: trusty
|
2018-12-06 12:52:30 +09:00
|
|
|
|
|
|
|
go:
|
|
|
|
- 1.11.x
|
|
|
|
|
2018-07-27 06:51:51 -04:00
|
|
|
env:
|
|
|
|
global:
|
2018-10-06 20:06:20 +09:00
|
|
|
- REGISTRY_USER=${REGISTRY_USER}
|
2018-11-15 16:13:00 -05:00
|
|
|
- REGISTRY_PASS=${REGISTRY_PASS}
|
2018-12-06 12:52:30 +09:00
|
|
|
- MULTUS_GOPATH=${PWD}/gopath
|
2018-10-06 20:06:20 +09:00
|
|
|
- secure: "${REGISTRY_SECURE}"
|
2018-03-14 17:05:24 +09:00
|
|
|
|
|
|
|
before_install:
|
|
|
|
- sudo apt-get update -qq
|
2018-08-02 12:04:05 -04:00
|
|
|
- go get github.com/mattn/goveralls
|
2018-03-14 17:05:24 +09:00
|
|
|
|
2018-03-28 17:21:52 +09:00
|
|
|
install:
|
2018-10-15 16:04:16 +09:00
|
|
|
- go get -u golang.org/x/lint/golint
|
2018-03-14 17:05:24 +09:00
|
|
|
|
2018-03-28 17:21:52 +09:00
|
|
|
before_script:
|
2018-12-06 12:52:30 +09:00
|
|
|
# Make gopath... to run golint/go fmt/go vet
|
|
|
|
- |-
|
|
|
|
if [ ! -h gopath/src/github.com/intel/multus-cni ]; then
|
|
|
|
mkdir -p gopath/src/github.com/intel
|
|
|
|
ln -s ../../../.. gopath/src/github.com/intel/multus-cni || exit 255
|
|
|
|
fi
|
|
|
|
- env GOPATH=${MULTUS_GOPATH} golint gopath/src/github.com/intel/multus-cni/multus/... | grep -v ALL_CAPS | xargs -r false
|
|
|
|
- env GOPATH=${MULTUS_GOPATH} go fmt gopath/src/github.com/intel/multus-cni/...
|
|
|
|
- go tool vet */*.go
|
2018-03-28 17:21:52 +09:00
|
|
|
# - gocyclo -over 15 ./multus
|
2018-03-14 17:05:24 +09:00
|
|
|
|
|
|
|
script:
|
|
|
|
- ./build
|
2018-06-14 22:52:09 -05:00
|
|
|
- sudo ./test.sh
|
2018-12-06 12:52:30 +09:00
|
|
|
- |-
|
|
|
|
GOV_GOPATH=${PWD}/gopath
|
|
|
|
pushd gopath/src/github.com/intel/multus-cni
|
|
|
|
env GOPATH=${GOV_GOPATH} ${GOPATH}/bin/goveralls -coverprofile=coverage.out -service=travis-ci
|
|
|
|
popd
|
2018-03-14 17:05:24 +09:00
|
|
|
- mkdir -p ${TRAVIS_BUILD_DIR}/dist
|
|
|
|
- tar cvfz ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz --warning=no-file-changed --exclude="dist" --exclude="vendor" .
|
2018-08-27 16:55:46 -04:00
|
|
|
- docker build -t nfvpe/multus .
|
2018-03-14 17:05:24 +09:00
|
|
|
|
2018-05-18 15:23:46 +09:00
|
|
|
deploy:
|
2018-12-06 12:52:30 +09:00
|
|
|
# Release on versioned tag (e.g. v1.0)
|
|
|
|
- provider: script
|
2018-07-27 06:51:51 -04:00
|
|
|
skip_cleanup: true
|
2018-12-06 12:52:30 +09:00
|
|
|
script: curl -sL https://git.io/goreleaser | bash
|
2018-07-27 06:51:51 -04:00
|
|
|
on:
|
|
|
|
tags: true
|
|
|
|
all_branches: true
|
|
|
|
condition: "$TRAVIS_TAG =~ ^v[0-9].*$"
|
2018-11-15 16:13:00 -05:00
|
|
|
# Push images to Dockerhub on tag
|
2018-07-27 06:51:51 -04:00
|
|
|
- provider: script
|
|
|
|
script: >
|
|
|
|
bash -c '
|
|
|
|
docker tag nfvpe/multus nfvpe/multus:$TRAVIS_TAG;
|
|
|
|
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
|
|
|
docker push nfvpe/multus;
|
2018-11-15 16:13:00 -05:00
|
|
|
docker push nfvpe/multus:$TRAVIS_TAG;
|
|
|
|
echo foo'
|
2018-07-27 06:51:51 -04:00
|
|
|
on:
|
|
|
|
tags: true
|
|
|
|
all_branches: true
|
|
|
|
condition: "$TRAVIS_TAG =~ ^v[0-9].*$"
|
2018-11-15 16:13:00 -05:00
|
|
|
# Push images to Dockerhub on merge to master
|
|
|
|
- provider: script
|
|
|
|
on:
|
|
|
|
branch: master
|
|
|
|
script: >
|
|
|
|
bash -c '
|
|
|
|
docker tag nfvpe/multus nfvpe/multus:snapshot;
|
|
|
|
docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS";
|
|
|
|
docker push nfvpe/multus:snapshot;
|
|
|
|
echo foo'
|
2018-05-18 15:23:46 +09:00
|
|
|
|
2018-03-14 17:05:24 +09:00
|
|
|
after_success:
|
|
|
|
# put build tgz to bintray
|
|
|
|
- curl -T ${TRAVIS_BUILD_DIR}/dist/multus-cni_amd64.tar.gz -u${BINTRAY_USER}:${BINTRAY_APIKEY} https://api.bintray.com/content/redhat-nfvpe/multus-cni-crd-snapshots/snapshot/snapshot-${TRAVIS_COMMIT}/multus-cni_amd64-${TRAVIS_COMMIT}.tar.gz
|
|
|
|
# publish uploaded file
|
|
|
|
- curl -X POST -u${BINTRAY_USER}:${BINTRAY_APIKEY} https://api.bintray.com/content/redhat-nfvpe/multus-cni-crd-snapshots/snapshot/snapshot-${TRAVIS_COMMIT}/publish
|
|
|
|
# put it in bintray download list
|
|
|
|
- sleep 20
|
|
|
|
- "curl -X PUT -H 'Accept: application/json' -H 'Content-type: application/json' -u${BINTRAY_USER}:${BINTRAY_APIKEY} https://api.bintray.com/file_metadata/redhat-nfvpe/multus-cni-crd-snapshots/multus-cni_amd64-${TRAVIS_COMMIT}.tar.gz -d '{\"list_in_downloads\":true}'"
|