about summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build-failed.sh11
-rw-r--r--scripts/builder.pl19
-rwxr-xr-xscripts/builder.sh21
3 files changed, 26 insertions, 25 deletions
diff --git a/scripts/build-failed.sh b/scripts/build-failed.sh
new file mode 100644
index 0000000..bddf4d0
--- /dev/null
+++ b/scripts/build-failed.sh
@@ -0,0 +1,11 @@
+COMMITER=$1
+MESSAGE=$2
+OUTPUT=$3
+SHA=$4
+
+echo "
+Message:
+$MESSAGE
+
+$OUTPUT
+" | mail -s "[jitterbug] BUILD FAILED $SHA" --to $COMMITER
diff --git a/scripts/builder.pl b/scripts/builder.pl
index b7b37c0..ae32056 100644
--- a/scripts/builder.pl
+++ b/scripts/builder.pl
@@ -46,21 +46,32 @@ while (1) {
             project    => $project,
             repo       => $repo,
             commit     => $commit,
-            status     => 1,
             time       => time(),
             %$desc,
         };
 
-        my @versions = glob($report_path.'/*');
+        my @versions = glob( $report_path . '/*' );
         foreach my $version (@versions) {
             open my $fh, '<', $version;
-            my @lines = <$fh>;
+            my @lines  = <$fh>;
             my $result = pop @lines;
+            while ( $result !~ /^Result/ ) {
+                $result = pop @lines;
+            }
             chomp $result;
             $result =~ s/Result:\s//;
-            my ($name, ) = basename($version);
+            my ( $name, ) = basename($version);
             $name =~ s/\.txt//;
+            if ( $result !~ /PASS/ ) {
+                # mail author of the commit
+                my $message  = $desc->{message};
+                my $commiter = $desc->{author}->{email};
+                my $output   = "Build failed";
+                my $sha      = $desc->{commit};
+                `./scripts/build-failed $commiter $message $output $sha`;
+            }
             $build->{version}->{$name} = $result;
+            close $fh;
         }
 
         my $build_key = join( ':', 'jitterbug', 'build', $commit );
diff --git a/scripts/builder.sh b/scripts/builder.sh
deleted file mode 100755
index 01eb92e..0000000
--- a/scripts/builder.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh -e
-
-gitrepo=$1
-project=$2
-commit=$3
-
-ORIGIN=$(pwd)
-BUILDDIR=$(mktemp -d)
-LOGDIR="/tmp/jitterbug"
-mkdir -p $LOGDIR
-logfile="$LOGDIR/$project.$commit.txt"
-cd $BUILDDIR
-rm -rf $project
-git clone $gitrepo $project
-cd $project
-git checkout $commit
-perl Makefile.PL
-make
-make test 2>&1 > $logfile
-cd ..
-rm -rf $BUILDDIR