language: go # see https://docs.travis-ci.com/user/reference/overview/#Virtualization-environments # for the detail # sudo: requried dist: trusty env: global: - REGISTRY_USER=${REGISTRY_USER} - REGISTRY_PASS=${REGISTRY_PASS} - secure: "${REGISTRY_SECURE}" before_install: - sudo apt-get update -qq - go get github.com/mattn/goveralls install: - go get -u golang.org/x/lint/golint before_script: - golint ./multus/... | grep -v ALL_CAPS | xargs -r false - go fmt ./multus/... - go vet ./multus/... # - gocyclo -over 15 ./multus script: - ./build - sudo ./test.sh - $GOPATH/bin/goveralls -coverprofile=coverage.out -service=travis-ci - 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" . - docker build -t nfvpe/multus . before_deploy: - go get -u github.com/laher/goxc - mkdir -p $TRAVIS_BUILD_DIR/dist - goxc -d=$TRAVIS_BUILD_DIR/dist -pv=$TRAVIS_TAG -bc=linux -tasks=clean-destination,xc,archive,rmbin deploy: - provider: releases api_key: secure: "${DEPLOY_SECURE}" file_glob: true file: "$TRAVIS_BUILD_DIR/dist/*/*.gz" skip_cleanup: true on: tags: true all_branches: true condition: "$TRAVIS_TAG =~ ^v[0-9].*$" # Push images to Dockerhub on tag - 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; docker push nfvpe/multus:$TRAVIS_TAG; echo foo' on: tags: true all_branches: true condition: "$TRAVIS_TAG =~ ^v[0-9].*$" # 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' 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}'"