aboutsummaryrefslogblamecommitdiff
path: root/scripts/test-hook.sh
blob: 64ca6b932c33a6fee83f04ab08f74d85f0929bff (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                               
          
                                                          



                                       
#!/usr/bin/env bash
set -Eeuo pipefail

WORK_TREE="$(mktemp -d)"
COMMIT="$(git rev-parse master)"
git --work-tree="$WORK_TREE" checkout -f master
cd "$WORK_TREE"

LOGS_PREFIX="/data/static/ci-logs"
LOGS_DIR="${LOGS_PREFIX}/website"
mkdir -p "$LOGS_DIR"

LOGFILE="${LOGS_DIR}/$(date -Is)-${COMMIT}.log"

touch "${LOGFILE}"
"${LOGS_PREFIX}"/ci-gen-index.sh

finish() {
  printf "\n\n>>> exit status was %s\n" "$1" >> "$LOGFILE"
}
trap finish EXIT

nix-build -A test 2>&1 | tee "$LOGFILE"