File: .travis.yml

package info (click to toggle)
golang-github-mendersoftware-scopestack 0.0~git20180403.c2f5599-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 108 kB
  • sloc: makefile: 2
file content (57 lines) | stat: -rw-r--r-- 2,100 bytes parent folder | download | duplicates (2)
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
language: go

# Golang version matrix
go:
    - 1.6

before_install:
    # Install code coverage / coveralls tooling
    - go get -u github.com/axw/gocov/gocov
    - go get -u github.com/mattn/goveralls
    - go get -u golang.org/x/tools/cmd/cover

    # Install godep for dependency management
    - go get -u github.com/tools/godep

    # Merge all subpackage code coverage reports into a single report
    - go get -u github.com/modocache/gover

    # Install cyclomatic dependency analysis tool
    - go get -u github.com/fzipp/gocyclo

before_script:
    # Print build info.
    - echo $TRAVIS_COMMIT
    - echo $TRAVIS_TAG
    - echo $TRAVIS_BRANCH
    - echo $TRAVIS_BUILD_NUMBER
    - echo $TRAVIS_REPO_SLUG

    # Test if code was formatted with 'go fmt'
    # Command will format code and return modified files
    # fail if any have been modified.
    - if [ -n "$(go fmt)" ]; then echo 'Code is not formatted with "go fmt"'; false; fi

    # Perform static code analysys
    - go tool vet -unsafeptr=false `go list ./... | grep -v Godeps | sed -e "s,^,$GOPATH/src/,;s,.*:,,"`

    # Fail builds when the cyclomatic complexity reaches 15 or more
    - gocyclo -over 15 `find . -iname '*.go' | grep -v 'Godeps' | grep -v '_test.go'`

script:
    # go list supply import paths for all sub directories.
    # Exclude Godeps directory, we don't want to run tests and coverage for all dependencies every time,
    # also including their coverage may introduce to much noice. Concentrate on the coverage of local packages.
    # Execute go test on every local subpackage (resolved as dependencies) and generate covreage report for each.
    # Test packages pararell (xargs -P)
    - go list ./... | grep -v Godeps | xargs -n1 -I {} -P 4 go test -v -covermode=count -coverprofile=../../../{}/profile.coverprofile {}

    # Compile binary
    - go build

after_success:
    # Merge all coverage reports located in subdirectories and put them under: gover.coverprofile
    - gover

    # Send code coverage report to coveralls.io
    - goveralls -service=travis-ci -coverprofile=gover.coverprofile