2018-08-03 10:51:20 +02:00
|
|
|
# https://gist.github.com/y0ssar1an/df2dab474520c4086926f672c52db139
|
|
|
|
|
|
|
|
# This is a weird way of telling Travis to use the fast container-based test
|
|
|
|
# runner instead of the slow VM-based runner.
|
|
|
|
sudo: false
|
|
|
|
|
2017-10-04 15:07:48 +02:00
|
|
|
language: go
|
|
|
|
go:
|
2018-08-03 10:51:20 +02:00
|
|
|
- "1.10"
|
2017-06-05 13:38:36 +02:00
|
|
|
|
2018-08-03 10:51:20 +02:00
|
|
|
# Only clone the most recent commit.
|
|
|
|
git:
|
|
|
|
depth: 1
|
2017-06-05 13:38:36 +02:00
|
|
|
|
2018-08-03 10:51:20 +02:00
|
|
|
env:
|
|
|
|
- DEP_VERSION="0.5.0"
|
|
|
|
|
|
|
|
before_install:
|
2018-08-03 11:54:26 +02:00
|
|
|
# Dump environment variables
|
|
|
|
- printenv
|
2018-08-03 10:51:20 +02:00
|
|
|
# Download the binary to bin folder in $GOPATH
|
|
|
|
- curl -L -s https://github.com/golang/dep/releases/download/v${DEP_VERSION}/dep-linux-amd64 -o $GOPATH/bin/dep
|
|
|
|
# Make the binary executable
|
|
|
|
- chmod +x $GOPATH/bin/dep
|
2017-10-04 15:07:48 +02:00
|
|
|
|
2017-06-05 13:38:36 +02:00
|
|
|
install:
|
2018-08-03 11:23:00 +02:00
|
|
|
- "go get -u github.com/jteeuwen/go-bindata/..."
|
|
|
|
- "dep ensure"
|
|
|
|
|
|
|
|
before_script:
|
|
|
|
- "go-bindata
|
2018-08-03 11:54:26 +02:00
|
|
|
-o=\"${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticow/bindata.go\"
|
|
|
|
-prefix=\"${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticow/data/\"
|
|
|
|
${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticow/data/..."
|
2017-06-05 13:38:36 +02:00
|
|
|
|
|
|
|
script:
|
2018-08-03 10:51:20 +02:00
|
|
|
# The Unit Tests
|
|
|
|
- "go test github.com/boramalper/magnetico/cmd/magneticod/..."
|
|
|
|
- "go test github.com/boramalper/magnetico/cmd/magneticow/..."
|
|
|
|
- "go test github.com/boramalper/magnetico/pkg/persistence/..."
|
|
|
|
|
|
|
|
# Static Analysis (vet)
|
|
|
|
- "go vet github.com/boramalper/magnetico/cmd/magneticod/..."
|
|
|
|
- "go vet github.com/boramalper/magnetico/cmd/magneticow/..."
|
|
|
|
- "go vet github.com/boramalper/magnetico/pkg/persistence/..."
|
|
|
|
|
|
|
|
# Formatting Errors
|
2018-08-03 12:11:36 +02:00
|
|
|
#
|
|
|
|
# Since gofmt returns zero even if there are files to be formatted, we use:
|
|
|
|
#
|
|
|
|
# ! gofmt -d ${GOPATH}/path/ 2>&1 | read
|
|
|
|
#
|
|
|
|
# to return 1 if there are files to be formatted, and 0 if not.
|
|
|
|
#
|
|
|
|
# https://groups.google.com/forum/#!topic/Golang-Nuts/pdrN4zleUio
|
|
|
|
- "! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticod/ 2>&1 | read"
|
|
|
|
- "! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/cmd/magneticow/ 2>&1 | read"
|
|
|
|
- "! gofmt -l ${GOPATH}/src/github.com/boramalper/magnetico/pkg/persistence/ 2>&1 | read"
|