#!/bin/sh
# Started by launchd on the CI Mac: runs zeitforge's runner for pi-c, one job
# at a time. The worker token is read from a 0600 file, never from argv.
set -eu
dir="$HOME/pic-ci"
[ -r "$dir/token" ] || { echo "pic-ci: no worker token at $dir/token" >&2; exit 1; }
QUARRY_RUNNER_TOKEN=$(cat "$dir/token")
export QUARRY_RUNNER_TOKEN
# launchd starts with a bare PATH; jobs need clang, make, perl and zit.
PATH="/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/.local/bin"
export PATH
exec "$dir/quarry-runner" --work "$dir/work" --max-tasks 1 https://zeitforge.app/r/dmestas/pi-c
