github.com/bartle-stripe/trillian@v1.2.1/.travis.yml (about) 1 sudo: true # Only to move mysql onto ramdisk. 2 3 language: go 4 5 addons: 6 apt: 7 sources: 8 - mysql-5.7-trusty 9 packages: 10 - softhsm 11 - mysql-server 12 - mysql-client 13 14 cache: 15 directories: 16 - "$HOME/google-cloud-sdk/" 17 18 os: 19 - linux 20 21 go: 22 - "1.10" 23 24 go_import_path: github.com/google/trillian 25 26 env: 27 - GCE_CI=${ENABLE_GCE_CI} WITH_COVERAGE=true 28 - GOFLAGS='-race' 29 - GOFLAGS='-race --tags batched_queue' 30 - GOFLAGS='-race' WITH_ETCD=true 31 - GOFLAGS='-race --tags pkcs11' WITH_PKCS11=true 32 33 matrix: 34 fast_finish: true 35 36 services: 37 - docker 38 39 before_install: 40 - sudo mysql -e "use mysql; update user set authentication_string=PASSWORD('') where User='root'; update user set plugin='mysql_native_password';FLUSH PRIVILEGES;" 41 - sudo mysql_upgrade 42 - sudo service mysql stop 43 - | 44 if [[ "$TRAVIS_SUDO" == "true" ]]; then 45 echo "Moving MySQL data to ramdisk..." 46 sudo mkdir /mnt/ramdisk 47 sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk 48 sudo mv /var/lib/mysql /mnt/ramdisk 49 sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql 50 else 51 echo "MySQL data staying on disk because sudo unavailable." 52 fi 53 - sudo service mysql start 54 55 install: 56 - mkdir ../protoc 57 - | 58 ( 59 cd ../protoc 60 wget "https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-${TRAVIS_OS_NAME}-x86_64.zip" 61 unzip "protoc-3.5.1-${TRAVIS_OS_NAME}-x86_64.zip" 62 ) 63 - export PATH="$(pwd)/../protoc/bin:$PATH" 64 # googleapis is not Go code, but it's required for .pb.go regeneration because of API dependencies. 65 - git clone --depth=1 https://github.com/googleapis/googleapis.git "$GOPATH/src/github.com/googleapis/googleapis" 66 - go get ${GOFLAGS} -d -t ./... 67 - go get github.com/golang/protobuf/proto 68 - go get github.com/golang/protobuf/protoc-gen-go 69 - go get golang.org/x/tools/cmd/stringer 70 - go get github.com/google/certificate-transparency-go 71 - go get -d -t github.com/google/certificate-transparency-go/... 72 - go install github.com/golang/{mock/mockgen,protobuf/protoc-gen-go} 73 - go get github.com/alecthomas/gometalinter 74 - gometalinter --install 75 # install vendored protoc-gen-grpc-gateway binary 76 - go install ./vendor/github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway 77 # install vendored etcd binary 78 - go install ./vendor/github.com/coreos/etcd/cmd/etcd 79 - go install ./vendor/github.com/coreos/etcd/cmd/etcdctl 80 81 82 before_script: 83 - yes | ./scripts/resetdb.sh 84 85 script: 86 - set -e 87 - cd "$HOME/gopath/src/github.com/google/trillian" 88 - export GO_TEST_TIMEOUT=20m 89 - ./scripts/presubmit.sh ${WITH_COVERAGE:+--coverage} 90 - | 91 # Check re-generation didn't change anything 92 # Skip protoc-generated files (.pb.go) because protoc is not deterministic 93 # when generating file descriptors. 94 status=$(git status --porcelain | grep -v .pb.go | grep -v _string.go) || : 95 if [[ -n ${status} ]]; then 96 echo "Regenerated files differ from checked-in versions: ${status}" 97 git status 98 git diff 99 exit 1 100 fi 101 - | 102 if [[ "${WITH_ETCD}" == "true" ]]; then 103 export ETCD_DIR="${GOPATH}/bin" 104 fi 105 - | 106 ./integration/integration_test.sh 107 cd "$HOME/gopath/src/github.com/google/certificate-transparency-go" 108 ./trillian/integration/integration_test.sh 109 cd $HOME/gopath/src/github.com/google/trillian 110 HAMMER_OPTS="--operations=50" ./integration/maphammer.sh 3 111 - set +e 112 113 after_success: 114 - bash <(curl -s https://codecov.io/bash) 115 - | 116 # Push up to GCE CI instance if we're running after a merge to master 117 if [[ "${GCE_CI}" == "true" ]] && [[ $TRAVIS_PULL_REQUEST == "false" ]] && [[ $TRAVIS_BRANCH == "master" ]]; then 118 . scripts/install_cloud.sh 119 120 echo ${GCLOUD_SERVICE_KEY_CI} | base64 --decode -i > ${HOME}/gcloud-service-key.json 121 gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json 122 rm ${HOME}/gcloud-service-key.json 123 124 . scripts/deploy_gce_ci.sh 125 fi