From 4e32f729c15f4e10657b479077b2d700a371ef1b Mon Sep 17 00:00:00 2001 From: David Nelson Date: Tue, 30 Apr 2019 20:19:43 -0500 Subject: [PATCH] Check that there are no source file changes before building If dependencies are changed (in package.json) without updating the yarn.lock file, or if any other part of the build process starts producing unignored files, the CI build will fail, so that the problem can be corrected before the PR is merged. --- .travis.yml | 2 ++ checkgit.sh | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100755 checkgit.sh diff --git a/.travis.yml b/.travis.yml index 8fa89666..777c536e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,6 @@ cache: directories: - "node_modules" script: + - ./checkgit.sh "Source files were modified before build; is yarn.lock out of sync with package.json?" || travis_terminate $? - yarn grunt + - ./checkgit.sh "Source files were modified by the build" || travis_terminate $? diff --git a/checkgit.sh b/checkgit.sh new file mode 100755 index 00000000..ee29eb4b --- /dev/null +++ b/checkgit.sh @@ -0,0 +1,6 @@ +GIT_STATUS=$(git status --porcelain | wc -l ) +if [[ GIT_STATUS -ne 0 ]]; then + echo "${1:-Source files were modified}" + git status + exit $GIT_STATUS +fi;