fix(local): make the trial-build gate detect non-throwing build failures #130

Merged
pat-s merged 1 commit from t3code/fix-gate-false-green into main 2026-07-16 08:24:03 +00:00

View file

@ -117,23 +117,34 @@ results <- vapply(
pkgs,
function(pkg) {
cat(sprintf("\n=== trial build: %s ===\n", pkg))
tryCatch(
{
bincraft::build_binary_package(
pkg,
tag_limit = 1L,
patches = patches_dir,
archive = FALSE,
upload = FALSE,
store_build_metadata = FALSE
)
TRUE
},
# bincraft::build_binary_package() catches build failures internally and
# RETURNS "error" for the failed tag rather than throwing, so a green gate
# must inspect the return value -- checking only for a thrown exception
# reports a broken build as passing.
res <- tryCatch(
bincraft::build_binary_package(
pkg,
tag_limit = 1L,
patches = patches_dir,
archive = FALSE,
upload = FALSE,
store_build_metadata = FALSE
),
error = function(e) {
cat(sprintf("FAILED %s: %s\n", pkg, conditionMessage(e)))
FALSE
cat(sprintf("FAILED %s (threw): %s\n", pkg, conditionMessage(e)))
"error"
}
)
flat <- as.character(unlist(res))
ok <- length(flat) > 0L && !("error" %in% flat)
if (!ok) {
cat(sprintf(
"FAILED %s: build did not succeed (result: %s)\n",
pkg,
if (length(flat) > 0L) toString(flat) else "<empty>"
))
}
ok
},
logical(1L)
)