3eefc7ccdafb3217229f6cb357c7b1c10c30919f
[febootstrap.git] / autobuild.sh
1 #!/bin/bash -
2
3 PROJECT=febootstrap
4 MAILTO=libguestfs@redhat.com
5
6 #----------------------------------------------------------------------
7 # Helper functions.
8
9 failed ()
10 {
11     mail -s "$(hostname -s) $PROJECT FAILED $1 $gitsha" $MAILTO < local-log
12 }
13
14 ok ()
15 {
16     mail -s "$(hostname -s) $PROJECT success $gitsha" $MAILTO < local-log
17 }
18
19 #----------------------------------------------------------------------
20
21 set -e
22 set -x
23
24 rm -f local-log
25 cat > local-log <<EOF
26
27 This is an automatic message generated by the builder on
28 $(hostname -s) for $PROJECT.  Log files from the build
29 follow below.
30
31 $(uname -a)
32 $(date)
33
34 -----
35
36 EOF
37 exec >> local-log 2>&1
38
39 # Pull from the public repo so that we don't need ssh-agent.
40 git pull --rebase git://git.annexia.org/git/febootstrap.git master
41 git clean -d -f
42
43 # The git version we are building.
44 gitsha=$(git log|head -1|awk '{print $2}')
45
46 # Do the configure step.
47 ./autogen.sh || {
48     failed "configure step"
49     exit 1
50 }
51
52 # Do the build step.
53 make || {
54     failed "build step"
55     exit 1
56 }
57
58 # Run the tests.
59 make check || {
60     failed "tests"
61     exit 1
62 }
63
64 ok