81 lines
No EOL
3.7 KiB
YAML
81 lines
No EOL
3.7 KiB
YAML
os: linux
|
|
dist: trusty
|
|
language: go
|
|
|
|
# Only the last two Go releases are supported by the Go team with security
|
|
# updates. Any versions older than that should be considered deprecated.
|
|
# Don't bother testing with them. tip builds your code with the latest
|
|
# development version of Go. This can warn you that your code will break
|
|
# in the next version of Go. Don't worry! Later we declare that test runs
|
|
# are allowed to fail on Go tip.
|
|
matrix:
|
|
include:
|
|
- go: 1.10.2
|
|
env: DEPLOY=true # dont deploy tip build
|
|
- go: master
|
|
env: DEPLOY=false # dont deploy tip build
|
|
allow_failures:
|
|
- go: master
|
|
# Don't wait for tip tests to finish. Mark the test run green if the
|
|
# tests pass on the stable versions of Go.
|
|
fast_finish: true
|
|
|
|
# Don't email me the results of the test runs.
|
|
notifications:
|
|
email: false
|
|
|
|
# Skip the install step. Don't `go get` dependencies. Only build with the
|
|
# code in vendor/
|
|
install: true
|
|
|
|
# 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.
|
|
before_script:
|
|
# All the .go files, excluding vendor/ and model (auto generated)
|
|
- GO_FILES=$(find . -iname '*.go' ! -iname '*_test.go' -type f | grep -v /vendor/ )
|
|
- go get golang.org/x/tools/cmd/goimports # Used in build script for generated files
|
|
- go get github.com/golang/lint/golint # Linter
|
|
- go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter
|
|
- go get github.com/jgautheron/gocyclo # Check against high complexity
|
|
- go get github.com/mdempsky/unconvert # Identifies unnecessary type conversions
|
|
- go get github.com/kisielk/errcheck # Checks for unhandled errors
|
|
- go get github.com/opennota/check/cmd/varcheck # Checks for unused vars
|
|
- go get github.com/opennota/check/cmd/structcheck # Checks for unused fields in structs
|
|
|
|
|
|
|
|
# script always run to completion (set +e). All of these code checks are must haves
|
|
# in a modern Go project.
|
|
script:
|
|
# Build Prism successfully
|
|
- make
|
|
# Fail if a .go file hasn't been formatted with gofmt
|
|
- test -z $(gofmt -s -l $GO_FILES)
|
|
# Run unit tests
|
|
- go test ./...
|
|
# Checks for unused vars and fields on structs
|
|
- varcheck ./...
|
|
- structcheck ./...
|
|
# go vet is the official Go static analyzer
|
|
- go vet ./...
|
|
# forbid code with huge functions
|
|
#- gocyclo -ignore "_test.go" -avg -over 19 $GO_FILES
|
|
# checks for unhandled errors
|
|
- errcheck ./...
|
|
# "go vet on steroids" + linter - ignore autogen code
|
|
- megacheck -simple.exit-non-zero=true ./...
|
|
# check for unnecessary conversions - ignore autogen code
|
|
- unconvert ./...
|
|
# one last linter - ignore autogen code
|
|
#- golint -set_exit_status $(go list ./... | grep -v /vendor/ )
|
|
|
|
deploy:
|
|
- provider: releases
|
|
file: prism-bin
|
|
skip_cleanup: true
|
|
on:
|
|
tags: true
|
|
condition: "$DEPLOY = true"
|
|
api_key:
|
|
secure: "ibN+PQg84f0tgJLV3KaHjkHmgFNOPqBLIrSU42moen22xxT2VIn0j7DkFaLLts1fs/+/gxmrvhOQ0vUFJqmflZ3kCeyedP/CVgZz7D7HRVK0cYUMJ2F9VWMZAFIX6A67OUlypqZqzKAKrZHx3HXky6Z8NBU23JgWqDm8PcrbbgMLvB2lvWVASjJVKreaL9BOxFOOOrAj6xAIm9ogTOnFVI/AhufNOKOTZaiprcbqMngwHeaILbwEJVqv5P2YUurC6Sq+QaH26tX00DtsYOW+n8AA3Fe48+L6rqa6Q8ru+dhPuR/Apr2+DTZ+npzY8leV3A7mYUeLo4JLaEH6n1TLVt65cX7nuesS7KsSKBSxs7q7bsqeapDcMskZz5JR4EK4S96CuHZEnn6+efpH8IrxWpbeO3EibJfyT8tMJKw7Zym5mPr+sz6xSlVMoBVcCm+7z9e7Zcqukdvdy8jM7sGP9qusqEhpojh0o+gPgr9p13SfR+6OCpj9gwxPCnZO8RBfh1cbz9vFSVlDyUYcpI2CCCpPazA1glTsEDk+VtznnUMmWksXWfxBFV81jQB2SnoZKlnsiEuNMwhiMCMEkRFo74+AsUr2UjmKJ5KC8ACwsn475PoLZBh2J6fyXBHMdbrGfK+Zt5K2IHRRtDaZVT4eHqYzxh8KhalsuBNxCo3FygI=" |