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.
This commit is contained in:
David Nelson 2019-04-30 20:19:43 -05:00
parent 761eb9e5ef
commit 4e32f729c1
2 changed files with 8 additions and 0 deletions

View file

@ -11,4 +11,6 @@ cache:
directories: directories:
- "node_modules" - "node_modules"
script: script:
- ./checkgit.sh "Source files were modified before build; is yarn.lock out of sync with package.json?" || travis_terminate $?
- yarn grunt - yarn grunt
- ./checkgit.sh "Source files were modified by the build" || travis_terminate $?

6
checkgit.sh Executable file
View file

@ -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;