.travis.yml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. sudo: true # required for CI push into Kubernetes.
  2. language: go
  3. os: linux
  4. go: "1.10"
  5. go_import_path: github.com/google/certificate-transparency-go
  6. env:
  7. - GCE_CI=${ENABLE_GCE_CI} GOFLAGS=
  8. - GOFLAGS=-race
  9. - GOFLAGS= WITH_ETCD=true WITH_COVERAGE=true
  10. - GOFLAGS=-race WITH_ETCD=true
  11. matrix:
  12. fast_finish: true
  13. addons:
  14. apt:
  15. sources:
  16. - mysql-5.7-trusty
  17. packages:
  18. - mysql-server
  19. - mysql-client
  20. services:
  21. - docker
  22. before_install:
  23. - sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;"
  24. - sudo mysql_upgrade
  25. - sudo service mysql restart
  26. install:
  27. - mkdir ../protoc
  28. - |
  29. (
  30. cd ../protoc
  31. wget https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-${TRAVIS_OS_NAME}-x86_64.zip
  32. unzip protoc-3.5.1-${TRAVIS_OS_NAME}-x86_64.zip
  33. )
  34. - export PATH=$(pwd)/../protoc/bin:$PATH
  35. - go get -d -t ./...
  36. - go get github.com/alecthomas/gometalinter
  37. - gometalinter --install
  38. - go get -u github.com/golang/protobuf/proto
  39. - go get -u github.com/golang/protobuf/protoc-gen-go
  40. - go install github.com/golang/mock/mockgen
  41. # install vendored etcd binary
  42. - go install ./vendor/github.com/coreos/etcd/cmd/etcd
  43. - go install ./vendor/github.com/coreos/etcd/cmd/etcdctl
  44. - pushd ${GOPATH}/src/github.com/google/trillian
  45. - go get -d -t ./...
  46. - popd
  47. script:
  48. - set -e
  49. - cd $HOME/gopath/src/github.com/google/certificate-transparency-go
  50. - ./scripts/presubmit.sh ${PRESUBMIT_OPTS} ${WITH_COVERAGE:+--coverage}
  51. - |
  52. # Check re-generation didn't change anything
  53. status=$(git status --porcelain | grep -v coverage) || :
  54. if [[ -n ${status} ]]; then
  55. echo "Regenerated files differ from checked-in versions: ${status}"
  56. git status
  57. git diff
  58. exit 1
  59. fi
  60. - |
  61. if [[ "${WITH_ETCD}" == "true" ]]; then
  62. export ETCD_DIR="${GOPATH}/bin"
  63. fi
  64. - ./trillian/integration/integration_test.sh
  65. - HAMMER_OPTS="--operations=1500" ./trillian/integration/ct_hammer_test.sh
  66. - set +e
  67. after_success:
  68. - cp /tmp/coverage.txt .
  69. - bash <(curl -s https://codecov.io/bash)
  70. - |
  71. # Push up to GCE CI instance if we're running after a merge to master
  72. if [[ "${GCE_CI}" == "true" ]] && [[ $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TRAVIS_BRANCH == "master" ]]; then
  73. . scripts/install_cloud.sh
  74. echo ${GCLOUD_SERVICE_KEY_CI} | base64 --decode -i > ${HOME}/gcloud-service-key.json
  75. gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json
  76. rm ${HOME}/gcloud-service-key.json
  77. . scripts/deploy_gce_ci.sh
  78. fi