[CI] isolate retrace summary images by device

This commit is contained in:
2026-06-27 22:57:24 +08:00
parent 9db9513c30
commit 0132781fff
+11 -2
View File
@@ -138,8 +138,12 @@ function inferCaseBackend(filePath) {
function inferGroup(filePath, defaultGroup) { function inferGroup(filePath, defaultGroup) {
const text = normalizeSlashes(filePath); const text = normalizeSlashes(filePath);
for (const token of ["HA27Q3LQ", "JNHUVK4XL7ZLWK7L"]) { for (const segment of text.split("/")) {
if (text.includes(token)) return token; const match = segment.match(/^android-retrace-(?:result|fixture|work)-(.+)$/);
if (!match) continue;
const parts = match[1].split("-");
const serial = parts[parts.length - 1];
if (serial) return serial;
} }
return defaultGroup; return defaultGroup;
} }
@@ -229,7 +233,12 @@ async function findImage(pngs, caseName, backend, kind, nearFile) {
} }
const scored = []; const scored = [];
const nearGroup = nearFile ? inferGroup(nearFile, "") : "";
for (const png of pngs) { for (const png of pngs) {
const text = normalizeSlashes(png);
if ((kind === "actual" || kind === "diff") && backend && !text.includes(backend)) continue;
const pngGroup = inferGroup(png, "");
if (nearGroup && pngGroup && pngGroup !== nearGroup) continue;
const score = scoreImage(png, caseName, backend, kind); const score = scoreImage(png, caseName, backend, kind);
if (score >= 7) scored.push({ score, png }); if (score >= 7) scored.push({ score, png });
} }