forked from stripe/stripe-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
82 lines (69 loc) · 2.7 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
before_install:
# Install various build dependencies. We use `travis_retry` because `go get`
# will occasionally fail intermittently.
# Testify is used for assertions in the test suite.
#
# Unfortunately, they broke versions of Go < 1.13. so we conditionally fetch
# and test only on newer versions of Go. We can back this conditional out
# once we've dropped < 1.13.
#
# Comparing versions lexically like this is technically not safe, but I'm
# cheating a bit by taking advantage of the fact that we only support > 1.9,
# so comparing Go versions lexically will be safe for quite some time -- well
# beyond the point where we back this out. `tip` also sorts after any version.
- |
if [[ "$TRAVIS_GO_VERSION" > "1.13" ]]; then
travis_retry go get -u github.com/stretchr/testify/require
fi
# Install lint / code coverage / coveralls tooling
- travis_retry go get -u golang.org/x/net/http2
- travis_retry go get -u golang.org/x/tools/cmd/cover
- travis_retry go get -u github.com/mattn/goveralls
- travis_retry go get -u golang.org/x/lint/golint
# Unpack and start the Stripe API stub so that the test suite can talk to it
- |
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
fi
- |
stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock -https-port 12112 -strict-version-check > /dev/null &
STRIPE_MOCK_PID=$!
# stripe-mock must be in PATH for `scripts/test_with_stripe_mock.go` to work.
- export PATH="${PATH}:${PWD}/stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}"
cache:
directories:
- stripe-mock
env:
global:
# If changing this number, please also change it in `testing/testing.go`.
- STRIPE_MOCK_VERSION=0.101.0
go:
- "1.10.x"
- "1.11.x"
- "1.12.x"
- "1.13.x"
- "1.14.x"
- "1.15.x"
- tip
language: go
matrix:
allow_failures:
- go: tip
fast_finish: true
script:
- |
# See note above, but Testify broke versions < 1.13, so we only build (and
# not test) on older versions. Drop this after we've dropped support for <
# 1.13.
if [[ "$TRAVIS_GO_VERSION" > "1.13" ]]; then
make
make coverage
else
make build
fi
after_script:
# Send code coverage report to coveralls.io
- goveralls -service=travis-ci -coverprofile=combined.coverprofile
sudo: false