Skip to content

Commit c1c5396

Browse files
msohailhussainMichael Ng
authored andcommitted
refact(ci): Refactored travis.yml file and introduced stages for unit test (#127)
1 parent 6d07846 commit c1c5396

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

.travis.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,18 @@
1-
env:
2-
- GO111MODULE=on
3-
4-
language: go
5-
go:
6-
- 1.12.x
7-
- master
8-
before_install:
9-
- go get github.com/mattn/goveralls
1+
language: minimal
2+
env: GO111MODULE=on
103
git:
114
depth: 1
12-
script:
13-
- go test -v -race ./... -coverprofile=profile.cov
14-
- $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci
5+
install:
6+
- eval "$(gimme)"
157
stages:
168
- 'Lint'
179
- 'Integration tests'
18-
- 'Test'
10+
- 'Unit test'
1911
jobs:
2012
include:
2113
- stage: 'Lint'
22-
install:
14+
env: GIMME_GO_VERSION=1.12.x GIMME_OS=linux GIMME_ARCH=amd64
15+
before_script:
2316
- curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(go env GOPATH)/bin v1.19.0
2417
script:
2518
- $GOPATH/bin/golangci-lint run --out-format=tab --tests=false optimizely/...
@@ -34,4 +27,28 @@ jobs:
3427
script:
3528
- "$HOME/travisci-tools/fsc-trigger/trigger_fullstack-sdk-compat.sh"
3629
after_success: travis_terminate 0
37-
30+
- &test
31+
stage: 'Unit test'
32+
env: GIMME_GO_VERSION=master GIMME_OS=linux GIMME_ARCH=amd64
33+
script:
34+
- go test -v -race ./... -coverprofile=profile.cov
35+
- <<: *test
36+
stage: 'Unit test'
37+
env: GIMME_GO_VERSION=1.8.x
38+
before_script:
39+
# GO module was not introduced earlier. need symlink to search in GOPATH
40+
- mkdir -p $GOPATH/src/github.com && pushd $GOPATH/src/github.com && ln -s $HOME/build/optimizely optimizely && popd
41+
script:
42+
# Need to download packages explicitly
43+
- go get -v -d ./...
44+
# This pkg not in go 1.8
45+
- go get github.com/stretchr/testify
46+
# -coverprofile was not introduced in 1.8
47+
- go test -v -race ./...
48+
- <<: *test
49+
stage: 'Unit test'
50+
env: GIMME_GO_VERSION=1.12.x
51+
before_script:
52+
- go get github.com/mattn/goveralls
53+
after_success:
54+
- $GOPATH/bin/goveralls -coverprofile=profile.cov -service=travis-ci

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Optimizely Go SDK
22

33
[![Go Report Card](https://goreportcard.com/badge/github.com/optimizely/go-sdk)](https://goreportcard.com/report/github.com/optimizely/go-sdk)
4-
[![Coverage Status](https://coveralls.io/repos/github/optimizely/go-sdk/badge.svg?branch=go-alpha)](https://coveralls.io/github/optimizely/go-sdk?branch=go-alpha)
4+
[![Coverage Status](https://coveralls.io/repos/github/optimizely/go-sdk/badge.svg?branch=master)](https://coveralls.io/github/optimizely/go-sdk?branch=master)
55

66
## Usage
77

0 commit comments

Comments
 (0)