Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

Add CI #75

Merged
merged 1 commit into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
bin
.vscode
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: go

go:
- 1.12.x
env:
- GO111MODULE=on
script:
- ./ci/ensuremod.sh
- ./ci/lint.sh
- go test -v ./...
22 changes: 22 additions & 0 deletions ci/ensuremod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# inspired by nhooyr's days as CI overlord
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥


set -eou pipefail

function help() {
echo
echo "you may need to update go.mod/go.sum via:"
echo "go list all > /dev/null"
echo "go mod tidy"
exit 1
}

go list -mod=readonly all > /dev/null

go mod tidy

if [[ $(git diff --name-only) != "" ]]; then
git diff
help
fi
17 changes: 17 additions & 0 deletions ci/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Inspired by nhooyr's days as CI overlord.

set -euo pipefail

files=$(gofmt -l -s .)

if [ ! -z "$files" ];
then
echo "The following files need to be formatted:"
echo "$files"
echo "Please run 'gofmt -w -s .'"
exit 1
fi

go vet -composites=false .