travis-ci: check that all build artifacts are .gitignore-d

Every once in a while our explicit .gitignore files get out of sync when our build process learns to create new artifacts, like test helper executables, but the .gitignore files are not updated accordingly. Use Travis CI to help catch such issues earlier: check that there are no untracked files at the end of any build jobs building Git (i.e. the 64 bit Clang and GCC Linux and OSX build jobs, plus the GETTEXT_POISON and 32 bit Linux build jobs) or its documentation, and fail the build job if there are any present. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Dec 31, 2017 at 17:02 UTC b92cb86ea1494c4dfbce28b29f05632ab9f3b179
4 files changed +20
ci/lib-travisci.sh
+10
@@ -67,6 +67,16 @@ skip_good_tree () {
67 exit 0
68 }
69
70 +check_unignored_build_artifacts ()
71 +{
72 + ! git ls-files --other --exclude-standard --error-unmatch \
73 + -- ':/*' 2>/dev/null ||
74 + {
75 + echo "$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)"
76 + false
77 + }
78 +}
79 +
80 # Set 'exit on error' for all CI scripts to let the caller know that
81 # something went wrong.
82 # Set tracing executed commands, primarily setting environment variables
ci/run-linux32-docker.sh
+2
@@ -23,4 +23,6 @@ docker run \
23 daald/ubuntu32:xenial \
24 /usr/src/git/ci/run-linux32-build.sh $(id -u $USER)
25
26 +check_unignored_build_artifacts
27 +
28 save_good_tree
ci/run-tests.sh
+2
@@ -8,4 +8,6 @@
8 ln -s $HOME/travis-cache/.prove t/.prove
9 make --quiet test
10
11 +check_unignored_build_artifacts
12 +
13 save_good_tree
ci/test-documentation.sh
+6
@@ -18,6 +18,9 @@ test -s Documentation/git.xml
18 test -s Documentation/git.1
19 grep '<meta name="generator" content="AsciiDoc ' Documentation/git.html
20
21 +rm -f stdout.log stderr.log
22 +check_unignored_build_artifacts
23 +
24 # Build docs with AsciiDoctor
25 make clean
26 make --jobs=2 USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.log >&2)
@@ -26,4 +29,7 @@ sed '/^GIT_VERSION = / d' stderr.log
29 test -s Documentation/git.html
30 grep '<meta name="generator" content="Asciidoctor ' Documentation/git.html
31
32 +rm -f stdout.log stderr.log
33 +check_unignored_build_artifacts
34 +
35 save_good_tree