From 7d00bc0452ef3a6d34db99c8a5d874c1d46f4aae Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Wed, 17 Apr 2019 21:05:49 -0600 Subject: [PATCH] Check more stuff in CI --- .gitlab-ci.yml | 3 +-- ci_check | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100755 ci_check 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 ./...