forked from google/trillian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
163 lines (158 loc) · 6.38 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
version: ~> 1.0
os: linux
dist: xenial
language: go
go: "1.13.x"
go_import_path: github.com/google/trillian
cache:
directories:
- "$HOME/google-cloud-sdk/"
- "$HOME/gopath/pkg/mod"
jobs:
fast_finish: true
include:
- name: "build"
before_install: skip
install: skip
before_script: skip
script: go build ./...
- name: "coverage"
before_install: skip
install: skip
before_script: skip
script: go test -covermode=atomic -coverprofile=coverage.txt ./...
after_success: bash <(curl -s https://codecov.io/bash)
- name: "generate"
before_install: skip
install:
- mkdir ../protoc
- |
echo "Installing Protobuf compiler"
(
set -e
cd ../protoc
wget "https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-${TRAVIS_OS_NAME}-x86_64.zip"
unzip "protoc-3.5.1-${TRAVIS_OS_NAME}-x86_64.zip"
)
- export PATH="$(pwd)/../protoc/bin:$PATH"
- git clone --depth=1 https://github.com/googleapis/googleapis.git "$GOPATH/src/github.com/googleapis/googleapis"
- go install github.com/golang/protobuf/proto
- go install github.com/golang/mock/mockgen
- go install golang.org/x/tools/cmd/stringer
- go install github.com/golang/protobuf/protoc-gen-go
- go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
- go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
before_script: go generate ./...
script:
- |
# Check re-generation didn't change anything. Skip protoc-generated files
# because protoc is not deterministic when generating file descriptors.
# Skip go.mod and go.sum because testing may add indirect dependencies
# that would be trimmed by 'go mod tidy'
echo "Checking that generated files are the same as checked-in versions."
git diff --exit-code -- ':!*.pb.go' ':!*_string.go' ':!go.*'
- name: "gomod"
before_install: skip
install: skip
before_script: go mod tidy -v
script: git diff --exit-code -- go.mod go.sum
- name: "lint"
before_install: skip
install:
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.21.0
- go install github.com/uber/prototool/cmd/prototool
- git clone --depth=1 https://github.com/googleapis/googleapis.git "$GOPATH/src/github.com/googleapis/googleapis"
before_script: skip
script:
- golangci-lint run --deadline=8m
- prototool lint
- ./scripts/check_license.sh $(find . -name '*.go' | grep -v mock_ | grep -v .pb.go | grep -v .pb.gw.go | grep -v _string.go | tr '\n' ' ')
- name: "bazel"
install:
- |
echo "Installing Bazel"
set -e
BAZEL_VERSION='1.1.0'
URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh"
wget -O install.sh ${URL}
chmod +x install.sh
./install.sh --user
rm -f install.sh
script:
- bazel build //:*
- bazel shutdown
- name: "docker"
script:
- |
# TODO(RJPercival): Make docker-compose integration test work when PKCS#11
# support is enabled. This requires running softhsm in a Docker container.
# See https://github.com/rolandshoemaker/docker-hsm for an example.
- ./integration/docker_compose_integration_test.sh
- name: "CT Integration"
script:
- |
set -e
TRILLIAN_DIR=$(pwd)
git clone --depth=1 https://github.com/google/certificate-transparency-go.git "$GOPATH/src/github.com/google/certificate-transparency-go"
(
cd "$GOPATH/src/github.com/google/certificate-transparency-go"
echo "replace github.com/google/trillian => $TRILLIAN_DIR" >> go.mod
chmod +x ./trillian/integration/integration_test.sh
./trillian/integration/integration_test.sh
)
- name: "presubmit"
env: GOFLAGS='-race' GO_TEST_TIMEOUT=20m
script: ./scripts/presubmit.sh --no-linters --no-generate
- name: "presubmit (batched_queue)"
env: GOFLAGS='-race --tags=batched_queue' GO_TEST_TIMEOUT=20m
script: ./scripts/presubmit.sh --no-linters --no-generate
- name: "presubmit (pkcs11)"
env: GOFLAGS='-race --tags=pkcs11' GO_TEST_TIMEOUT=20m
script: ./scripts/presubmit.sh --no-linters --no-generate
- name: "integration"
env: GO_TEST_TIMEOUT=20m
script: ./integration/integration_test.sh && HAMMER_OPTS="--operations=150" ./integration/maphammer.sh 3
- name: "integration (etcd)"
env: GOFLAGS='-race' ETCD_DIR="${GOPATH}/bin" GO_TEST_TIMEOUT=20m
install: go install go.etcd.io/etcd go.etcd.io/etcd/etcdctl github.com/fullstorydev/grpcurl/cmd/grpcurl
script: ./integration/integration_test.sh && HAMMER_OPTS="--operations=50" ./integration/maphammer.sh 3
- name: "integration (batched_queue)"
env: GOFLAGS='-race --tags=batched_queue' GO_TEST_TIMEOUT=20m
script: ./integration/integration_test.sh && HAMMER_OPTS="--operations=50" ./integration/maphammer.sh 3
- name: "integration (pkcs11)"
env: GOFLAGS='-race --tags=pkcs11' GO_TEST_TIMEOUT=20m
install:
- sudo apt-get update
- sudo apt-get install -y softhsm
script: ./integration/integration_test.sh && HAMMER_OPTS="--operations=50" ./integration/maphammer.sh 3
- name: "integration (mariaDB)"
addons:
mariadb: '10.3'
env: GO_TEST_TIMEOUT=20m
script:
- mysql -u root -e 'SHOW VARIABLES LIKE "%version%";'
- go test ./storage/mysql/...
- ./integration/integration_test.sh && HAMMER_OPTS="--operations=50" ./integration/maphammer.sh 3
services:
- docker
- postgresql
- mysql
- redis
before_install:
- sudo service mysql stop
- |
echo "Attempting to move MySQL data to ramdisk..."
set -e
if [[ "$TRAVIS_SUDO" == "true" ]]; then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
else
echo "Failed - MySQL data staying on disk because sudo unavailable."
fi
- sudo service mysql start
before_script:
- ./scripts/resetdb.sh --force
- ./scripts/mysqlconnlimit.sh --force
- ./scripts/postgres_resetdb.sh --force