aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-29 07:06:41 -0300
committerEuAndreh <eu@euandre.org>2020-08-29 07:06:41 -0300
commitebb8fe0a230ceec38e5e23f1aa887dbb8dbb233e (patch)
tree1d28295c76894e1a4e14a0351ca49640dee3f3e1 /scripts
parentdefault.html: Add trailing close / to <meta> tags (diff)
downloadeuandre.org-ebb8fe0a230ceec38e5e23f1aa887dbb8dbb233e.tar.gz
euandre.org-ebb8fe0a230ceec38e5e23f1aa887dbb8dbb233e.tar.xz
Add scripts/test-hook.sh
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/test-hook.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/test-hook.sh b/scripts/test-hook.sh
new file mode 100755
index 0000000..0a561ae
--- /dev/null
+++ b/scripts/test-hook.sh
@@ -0,0 +1,28 @@
+#!/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
+
+status() {
+ printf "\n\n>>> exit status was %s\n" "$1" >> "$LOGFILE"
+}
+
+finish() {
+ status "$?"
+}
+trap finish EXIT
+
+nix-build -A test 2>&1 | tee "$LOGFILE"
+status "$?"