Skip to content

Commit 6f4dde1

Browse files
committed
Add ci script
1 parent 8ea9880 commit 6f4dde1

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

.travis.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Abort on Error
4+
set -e
5+
6+
export PING_SLEEP=30s
7+
export WORKDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
export BUILD_OUTPUT=$WORKDIR/build.out
9+
10+
touch $BUILD_OUTPUT
11+
12+
dump_output() {
13+
echo Tailing the last 500 lines of output:
14+
tail -500 $BUILD_OUTPUT
15+
}
16+
error_handler() {
17+
echo ERROR: An error was encountered with the build.
18+
dump_output
19+
kill $PING_LOOP_PID
20+
exit 1
21+
}
22+
# If an error occurs, run our error handler to output a tail of the build
23+
trap 'error_handler' ERR
24+
25+
# Set up a repeating loop to send some output to Travis.
26+
27+
bash -c "while true; do echo \$(date) - building ...; sleep $PING_SLEEP; done" &
28+
PING_LOOP_PID=$!
29+
30+
# Build commands:
31+
make test-ci >> $BUILD_OUTPUT 2>&1
32+
make coverage >> $BUILD_OUTPUT 2>&1
33+
34+
# The build finished without returning an error so dump a tail of the output
35+
dump_output
36+
37+
# nicely terminate the ping output loop
38+
kill $PING_LOOP_PID

0 commit comments

Comments
 (0)