Add Travis CI support

The tests are currently executed on "Ubuntu 12.04 LTS Server Edition 64 bit" and on "OS X Mavericks" using gcc and clang. Perforce and Git-LFS are installed and therefore available for the respective tests. Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Jeff King <peff@peff.net>

Lars Schneider committed Nov 27, 2015 at 10:23 UTC 522354d70f4fab744f25bc3d641b478584bbfc3b
1 file changed +91
.travis.yml new
+91
@@ -0,0 +1,91 @@
1 +language: c
2 +
3 +os:
4 + - linux
5 + - osx
6 +
7 +compiler:
8 + - clang
9 + - gcc
10 +
11 +addons:
12 + apt:
13 + packages:
14 + - language-pack-is
15 +
16 +env:
17 + global:
18 + - P4_VERSION="15.2"
19 + - GIT_LFS_VERSION="1.1.0"
20 + - DEFAULT_TEST_TARGET=prove
21 + - GIT_PROVE_OPTS="--timer --jobs 3"
22 + - GIT_TEST_OPTS="--verbose --tee"
23 + - CFLAGS="-g -O2 -Wall -Werror"
24 + - GIT_TEST_CLONE_2GB=YesPlease
25 + # t9810 occasionally fails on Travis CI OS X
26 + # t9816 occasionally fails with "TAP out of sequence errors" on Travis CI OS X
27 + - GIT_SKIP_TESTS="t9810 t9816"
28 +
29 +before_install:
30 + - >
31 + case "${TRAVIS_OS_NAME:-linux}" in
32 + linux)
33 + mkdir --parents custom/p4
34 + pushd custom/p4
35 + wget --quiet http://filehost.perforce.com/perforce/r$P4_VERSION/bin.linux26x86_64/p4d
36 + wget --quiet http://filehost.perforce.com/perforce/r$P4_VERSION/bin.linux26x86_64/p4
37 + chmod u+x p4d
38 + chmod u+x p4
39 + export PATH="$(pwd):$PATH"
40 + popd
41 + mkdir --parents custom/git-lfs
42 + pushd custom/git-lfs
43 + wget --quiet https://github.com/github/git-lfs/releases/download/v$GIT_LFS_VERSION/git-lfs-linux-amd64-$GIT_LFS_VERSION.tar.gz
44 + tar --extract --gunzip --file "git-lfs-linux-amd64-$GIT_LFS_VERSION.tar.gz"
45 + cp git-lfs-$GIT_LFS_VERSION/git-lfs .
46 + export PATH="$(pwd):$PATH"
47 + popd
48 + ;;
49 + osx)
50 + brew_force_set_latest_binary_hash () {
51 + FORMULA=$1
52 + SHA=$(brew fetch --force $FORMULA 2>&1 | grep ^SHA256: | cut -d ' ' -f 2)
53 + sed -E -i.bak "s/sha256 \"[0-9a-f]{64}\"/sha256 \"$SHA\"/g" \
54 + /usr/local/Library/Taps/homebrew/homebrew-binary/$FORMULA.rb
55 + }
56 + brew update --quiet
57 + brew tap homebrew/binary --quiet
58 + brew_force_set_latest_binary_hash perforce
59 + brew_force_set_latest_binary_hash perforce-server
60 + brew install git-lfs perforce-server perforce gettext
61 + brew link --force gettext
62 + ;;
63 + esac;
64 + echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)";
65 + p4d -V | grep Rev.;
66 + echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)";
67 + p4 -V | grep Rev.;
68 + echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)";
69 + git-lfs version;
70 +
71 +before_script: make --jobs=2
72 +
73 +script: make --quiet test
74 +
75 +after_failure:
76 + - >
77 + : '<-- Click here to see detailed test output! ';
78 + for TEST_EXIT in t/test-results/*.exit;
79 + do
80 + if [ "$(cat "$TEST_EXIT")" != "0" ];
81 + then
82 + TEST_OUT="${TEST_EXIT%exit}out";
83 + echo "------------------------------------------------------------------------";
84 + echo "$(tput setaf 1)${TEST_OUT}...$(tput sgr0)";
85 + echo "------------------------------------------------------------------------";
86 + cat "${TEST_OUT}";
87 + fi;
88 + done;
89 +
90 +notifications:
91 + email: false