forked from GoogleCloudPlatform/golang-samples
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.yml
55 lines (48 loc) · 1.78 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
language: go
# Don't build other branches that are being used for PRs.
# Currently only the master branch is used in this repo.
branches:
only:
- master
matrix:
include:
- go: 1.5.4
- go: 1.6.2
env: ALLOW_E2E=true # Don't run e2e tests more than once.
# NOTE: no tip, see https://github.com/travis-ci/gimme/issues/38
before_cache:
- rm -rf $GOPATH/src/github.com/GoogleCloudPlatform/golang-samples/*
- rm -rf $GOPATH/pkg/**/github.com/GoogleCloudPlatform/golang-samples
cache:
directories:
- $GOPATH/src
- $GOPATH/pkg
before_install:
- if [ $SYSTEM_TESTS ]; then
openssl aes-256-cbc -K $encrypted_e44ee91b46d4_key -iv $encrypted_e44ee91b46d4_iv -in key.json.enc -out key.json -d;
export GOLANG_SAMPLES_PROJECT_ID=golang-samples-tests;
export GOOGLE_APPLICATION_CREDENTIALS="$(pwd)/key.json";
else
echo "Not running system tests.";
fi
- if [ $ALLOW_E2E ]; then
curl -s https://api.travis-ci.org/builds/$TRAVIS_BUILD_ID | jq . | tee /tmp/build.json;
export NIGHTLY=$(jq '.event_type=="api" and (.message|contains("CIAEON=true"))' < /tmp/build.json);
export FORCE_E2E=$(jq '.message|contains("FORCE_E2E=true")' < /tmp/build.json);
if [ $NIGHTLY = "true" ] || [ $FORCE_E2E = "true" ]; then
export GOLANG_SAMPLES_E2E_TEST=true;
fi;
fi
- if [ $GOLANG_SAMPLES_E2E_TEST ]; then
echo "This test run will run end-to-end tests.";
go get -u google.golang.org/appengine/cmd/aedeploy;
export PATH="$PATH:$PWD/google-cloud-sdk/bin";
./testing/travis/configure_gcloud.bash;
fi
install:
# Install all external dependencies, ensuring they are updated.
- go get -u -v $(go list -f '{{join .Imports "\n"}}' ./... | sort | uniq | grep -v golang-samples)
script:
- go test -v ./...
- go vet ./...
- diff -u <(echo -n) <(gofmt -d -s .)