-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-release.sh
executable file
·62 lines (49 loc) · 1.72 KB
/
run-release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash
#
# This script checks whether all tests passed in the latest batch,
# and then merges the master with the release branch.
#
# Use as
# run-release.sh
# to check and merge the latest revision that was executed, or
# run-release.sh <REVISION>
# for a specific revision.
#
# This script is scheduled for execution on the torque cluster by schedule-batch.sh
#
# make it robust for running as a cron job
GREP=/usr/bin/grep
AWK=/usr/bin/awk
LS=/usr/bin/ls
GIT=/usr/bin/git
MAIL=/usr/bin/mail
# ensure that other team members can read the results
umask 0022
TRUNK=$HOME/fieldtrip/release/fieldtrip
DASHBOARDDIR=$HOME/fieldtrip/dashboard
REVISION=$1
if [ -z "$REVISION" ] ; then
# determine the revision of the latest version that ran
REVISION=$(cat $DASHBOARDDIR/logs/latest/revision)
fi
# stop here if the revision cannot be determined
[ -z "$REVISION" ] && exit 1
LOGDIR=$DASHBOARDDIR/logs/$REVISION
BRANCH=$(cat $LOGDIR/branch)
FAILED=$($GREP FAILED $LOGDIR/*.txt | wc -l)
PASSED=$($GREP PASSED $LOGDIR/*.txt | wc -l)
# execute grep one directory up from the actual revision results, this includes the revision in the email body
# cd $LOGDIR/..
# $GREP FAILED $REVISION/*.txt | $MAIL -r [email protected] -s "FAILED tests in latest FieldTrip batch" [email protected]
# $GREP PASSED $REVISION/*.txt | $MAIL -r [email protected] -s "PASSED tests in latest FieldTrip batch" [email protected]
if [ "$BRANCH" == "master" ]; then
if [ $FAILED -eq 0 ]; then
if [ $PASSED -gt 600 ]; then
echo merging $LATEST into release
cd $TRUNK && $GIT checkout master && $GIT pull upstream master && $GIT checkout release
$GIT log -1 $REVISION || exit 1
$GIT merge $REVISION
$GIT push upstream release
fi
fi
fi