Skip to content

Instantly share code, notes, and snippets.

@tboztuna
Forked from ryboe/.travis.yml
Created July 29, 2018 08:57
Show Gist options
  • Save tboztuna/9c1bea3bb882d20e4f34cf15d4bfaa67 to your computer and use it in GitHub Desktop.
Save tboztuna/9c1bea3bb882d20e4f34cf15d4bfaa67 to your computer and use it in GitHub Desktop.
Example .travis.yml for Golang
# 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
language: go
# Only the last two Go releases are supported by the Go team with security
# updates. Any older versions be considered deprecated. Don't bother testing
# with them.
go:
- 1.9.x
- 1.x
# Only clone the most recent commit.
git:
depth: 1
# Skip the install step. Don't `go get` dependencies. Only build with the code
# in vendor/
install: true
# Don't email me the results of the test runs.
notifications:
email: false
# Anything in before_script that returns a nonzero exit code will flunk the
# build and immediately stop. It's sorta like having set -e enabled in bash.
# Make sure golangci-lint is vendored by running
# dep ensure -add github.com/golangci/golangci-lint/cmd/golangci-lint
# ...and adding this to your Gopkg.toml file.
# required = ["github.com/golangci/golangci-lint/cmd/golangci-lint"]
before_script:
- go install ./vendor/github.com/golangci/golangci-lint/cmd/golangci-lint
# script always runs to completion (set +e). If we have linter issues AND a
# failing test, we want to see both. Configure golangci-lint with a
# .golangci.yml file at the top level of your repo.
script:
- golangci-lint run # run a bunch of code checkers/linters in parallel
- go test -v -race ./... # Run all the tests with the race detector enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment