-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnightly.sh
56 lines (40 loc) · 1.25 KB
/
nightly.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
#!/bin/bash
echo "Beginning peggy nightly script..."
# -x: before executing each command, print it
# -e: exit immediately upon first error
set -x -e
# if anything in a pipeline fails, fail the whole pipeline
set -o pipefail
# determine physical directory of this script
src="${BASH_SOURCE[0]}"
while [ -L "$src" ]; do
dir="$(cd -P "$(dirname "$src")" && pwd)"
src="$(readlink "$src")"
[[ $src != /* ]] && src="$dir/$src"
done
MYDIR="$(cd -P "$(dirname "$src")" && pwd)"
# Absolute directory paths
NIGHTLY_DIR="$MYDIR/nightly"
OUTPUT_DIR="$NIGHTLY_DIR/output"
DATA_DIR="$NIGHTLY_DIR/data"
# Make sure we're in the right place
cd $MYDIR
echo "Switching to nighly script directory: $MYDIR"
# Clean previous nightly run
# CAREFUL using -f
rm -rf $NIGHTLY_DIR
# Prepare output directories
mkdir -p "$NIGHTLY_DIR" "$NIGHTLY_DIR/data" "$OUTPUT_DIR"
# run setup.sh
source setup.sh
# run run.sh
source run.sh
# copy data directory to output
cp -r "$DATA_DIR" "$OUTPUT_DIR"
# This is the uploading part, copied directly from Herbie's nightly script.
DIR="$OUTPUT_DIR"
B=$(git rev-parse --abbrev-ref HEAD)
C=$(git rev-parse HEAD | sed 's/\(..........\).*/\1/')
RDIR="$(date +%s):$(hostname):$B:$C"
# Upload the artifact!
nightly-results publish --name "$RDIR" "$DIR"