diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 047263f..be40336 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,3 @@ test: script: - - go vet -v ./... - - go test -v ./... + - ./ci_check diff --git a/ci_check b/ci_check new file mode 100755 index 0000000..4a6f801 --- /dev/null +++ b/ci_check @@ -0,0 +1,26 @@ +#!/bin/sh +set -e +old_dir=$PWD +new_dir=`mktemp -d` + +cleanup() { + rm -rf "$new_dir" +} +trap cleanup EXIT + +cp -r . "$new_dir" +cd "$new_dir" + +checkgen() { + $1 + if ! diff -r . "$old_dir" + then + echo $2 1>&2 + return 1 + fi +} + +checkgen 'go generate ./...' 'Generated files not up-to-date. Please run go generate.' +checkgen 'go fmt ./...' '.go files not formatted. Please run go fmt.' +go vet ./... +go test ./...