aboutsummaryrefslogtreecommitdiff
path: root/bin/files-changed
diff options
context:
space:
mode:
authorJoseph Richey <joerichey94@gmail.com>2018-02-11 21:22:53 -0800
committerJoseph Richey <joerichey94@gmail.com>2018-02-11 21:38:13 -0800
commitb330463662825a7d7b22efabb2b7a40640d2b18e (patch)
tree5f6fdc40c7518bc23a63fdac9a92b516dd0c6d36 /bin/files-changed
parenta9c3c4fdfbdd9b4ab7e82f5b237d040be68886e0 (diff)
travis: use multiple build stages
This change rewrites .travis.yml to use many build stages/jobs. This allows our build to run faster, as almost all jobs run in containers. Stage 1: Run on all pushes to all branches - Job Build: just runs "make" to make sure everything is OK Stage 2: Run on all PRs and pushes to master - Job Lint: Makes sure dep, "make gen", "make format", and "make lint" are all happy. - Job Build 1: Make sure "go get" and "make" will work. This job will later run unit tests. - Job Build 2: Same as Job Build 1, except with another go version. - Job Integeration: Run integration tests (needs sudo, so needs VM) Stage 3: Run on releases (if other stages pass) - Job Deploy: Publishes amd64 binaries to GitHub.
Diffstat (limited to 'bin/files-changed')
-rwxr-xr-xbin/files-changed25
1 files changed, 25 insertions, 0 deletions
diff --git a/bin/files-changed b/bin/files-changed
new file mode 100755
index 0000000..3ffbad6
--- /dev/null
+++ b/bin/files-changed
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Detect if any files have changed in the git repository. Output an appropriate
+# error message if they have changed.
+
+if [[ -n $(git status -s) ]]; then
+ git diff --minimal HEAD
+ echo
+ echo "**************************************************"
+ case "$1" in
+ "proto")
+ echo "* .pb.go files and .proto files are out of sync. *"
+ echo "* Run \"make gen\" to generate them. *"
+ ;;
+ "format")
+ echo "* C or Go files have incorrect formatting. *"
+ echo "* Run \"make format\" to fix them. *"
+ ;;
+ *)
+ echo "* Files have changed in this repository. *"
+ ;;
+ esac
+ echo "**************************************************"
+ git reset HEAD --hard
+ exit 1
+fi \ No newline at end of file