#!/bin/sh
# script/cibuild: run the CI build. The Gitea workflow runs this on
# push. The Dockerfile runs every gate make check runs, as build steps,
# so a successful build means the repo is green.
#
# Without a fresh CHECK_EPOCH, a rebuild of an unchanged checkout serves
# the gate layers from cache and passes having run none of them. The
# process id goes in with the epoch so two runs started in the same
# second still differ.
set -eu

ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"

main() {
    cd "$ROOT"
    docker build --build-arg CHECK_EPOCH="$(date +%s)-$$" .
}

main "$@"
