Skip to content

Instantly share code, notes, and snippets.

@lovesegfault
Created January 3, 2020 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovesegfault/e531c02959f5a8bf44d8fe299a807fd3 to your computer and use it in GitHub Desktop.
Save lovesegfault/e531c02959f5a8bf44d8fe299a807fd3 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ -z "$1" ]; then
input=release.nix
else
input=$1
shift
fi
echo '~~~ Evaluating '$input
command time --format '%e' -o eval-time.txt hydra-eval-jobs \
-I /nix/store/7zi37yp9zg5j8n7g8qy5r05c5b3sylam-nixpkgs \
-I /nix/store/755y4z8fs48l3zxn7c4chx01rvn2lzzh-nixpkgs \
-I /nix/store/96qmb25czapyni7dff24d0zs2p89cyji-nixpkgs \
-I /nix/store/p0xhic15fgy60rd3iig5gaqmwmcsdlfj-nixpkgs \
-I . "$input" \
"$@" > eval.json
EVAL_EXIT_CODE="$?"
if [ "$EVAL_EXIT_CODE" != 0 ]
then
rm eval.json eval-time.txt
echo -e "\\e[31;1mERROR: Failed to evaluate $input\\e[0m"
exit 1
fi
EVAL_TIME=$(cat eval-time.txt)
jq . < eval.json
ERRORS=$(jq -r 'map_values(.error)|to_entries[]|select(.value)|@text "\(.key): \(.value)"' < eval.json)
NUM_ERRORS=$(jq -r '[ map_values(.error)|to_entries[]|select(.value) ] |length' < eval.json)
rm eval.json eval-time.txt
if [ "$NUM_ERRORS" != 0 ]
then
echo -e "\\e[31;1mERROR: evaluation completed in $EVAL_TIME seconds with $NUM_ERRORS errors\\e[0m"
echo "$ERRORS"
exit 1
else
echo -e "\\e[32;1mOK: evaluation completed in $EVAL_TIME seconds with no errors\\e[0m"
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment