Created
April 20, 2020 13:34
-
-
Save dsprenkels/fa72182655268a95cdba446a62060695 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Do a nightly build of LLVM master. | |
# | |
# Author: Daan Sprenkels <[email protected]> | |
set -e | |
WORKSPACE="$1" | |
# Determine what our llvm workspace is (probably "$HOME/llvm"). | |
if [ -z "$WORKSPACE" ] | |
then | |
WORKSPACE="$(dirname "$(realpath "$0")")" | |
elif [ ! -d "$WORKSPACE" ] | |
then | |
echo >&2 "Did not find directory $WORKSPACE." | |
exit 1 | |
fi | |
# Error if there is no "llvm-project" directory | |
if [ ! -d "$WORKSPACE/llvm-project" ] | |
then | |
echo >&2 "Did not find directory $WORKSPACE/llvm-project." | |
exit 1 | |
fi | |
# Error if there is no "llvm-build" directory | |
if [ ! -d "$WORKSPACE/llvm-build" ] | |
then | |
echo >&2 "Did not find directory $WORKSPACE/llvm-build." | |
exit 1 | |
fi | |
# Check if the server is doing something else at the moment. | |
if [ "$(cut </proc/loadavg -f 2 -d ' ' | cut -f 1 -d '.')" != '0' ] | |
then | |
# Thom is probably running benchmarks. | |
exit 125 | |
fi | |
# Checkout the most recent version of the LLVM repository. | |
( | |
cd "$WORKSPACE/llvm-project" | |
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ] | |
then | |
# Daan is currenlty working on something. Do not disturb the state | |
# of their current checked out source tree. | |
exit 0 | |
fi | |
git pull upstream master --rebase --autostash | |
) | |
# Do a nightly build. | |
( | |
cd "$WORKSPACE/llvm-build" | |
nice -n 15 ninja | |
) | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment