Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
#26 Add CI jobs/stages
Browse files Browse the repository at this point in the history
  • Loading branch information
matt0x6F committed Oct 20, 2018
1 parent 1a5af4c commit 87826cf
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
language: go

# Always use a string here, floats can result in unintended consequences
go:
- "1.11.x"

stages:
- name: "Testing" # Fires every time
- name: "Build"
if: branch = master
- name: "Deploy"
if: branch = master

jobs:
include:
- stage: "Testing"
name: "Pre-commit"
script:
- ./scripts/pre-commit.sh
17 changes: 17 additions & 0 deletions scripts/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

GOFMT_FILES=$(gofmt -l .)
if [ -n "${GOFMT_FILES}" ]; then
printf >&2 'gofmt failed for the following files:\n%s\n\nplease run "gofmt -w ." on your changes before committing.\n' "${GOFMT_FILES}"
exit 1
fi

GOVET_ERRORS=$(go tool vet *.go 2>&1)
if [ -n "${GOVET_ERRORS}" ]; then
printf >&2 'go vet failed for the following reasons:\n%s\n\nplease run "go tool vet *.go" on your changes before committing.\n' "${GOVET_ERRORS}"
exit 1
fi

if [ -z "${NOTEST}" ]; then
go test -v -short ./...
fi

0 comments on commit 87826cf

Please sign in to comment.