diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 595f496e1d..23aa1f21de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -746,8 +746,30 @@ jobs: docker run --rm -i -v "$PWD:/scripts" -w /scripts ${{ env.IMAGE }}:after php <<'PHP' > benchmark-comment.txt getMessage()}\n"); + exit(1); + } + + if (!is_array($summary)) { + fwrite(STDERR, "Invalid benchmark summary {$path}: expected JSON object\n"); + exit(1); + } + + return $summary; + } + + $before = read_summary('benchmark-before-summary.json'); + $after = read_summary('benchmark-after-summary.json'); function metric_value(?array $data, string $metric, string $stat): mixed { diff --git a/tests/benchmarks/http.php b/tests/benchmarks/http.php index 3d7556e8d7..1c28ef33ea 100644 --- a/tests/benchmarks/http.php +++ b/tests/benchmarks/http.php @@ -290,7 +290,12 @@ final class HttpBenchmark $context = $this->setup(); for ($i = 0; $i < $this->iterations * $this->vus; $i++) { - $this->curatedFlows($context); + try { + $this->curatedFlows($context); + } catch (Throwable $error) { + $exitCode = 1; + fwrite(STDERR, 'Iteration ' . ($i + 1) . ' failed: ' . $error->getMessage() . PHP_EOL); + } } } catch (Throwable $error) { $exitCode = 1; @@ -1216,7 +1221,7 @@ final class HttpBenchmark '', ]; - return implode(PHP_EOL, array_filter($lines, fn (string $line): bool => $line !== '')) . PHP_EOL; + return implode(PHP_EOL, $lines) . PHP_EOL; } private function comparisonTable(?array $before, array $after): string