From 1bd9d55cbb0e76f5723c9e2bd210c1f32a9a4aa1 Mon Sep 17 00:00:00 2001 From: frostebite Date: Fri, 28 Aug 2026 15:14:49 +0100 Subject: [PATCH 1/3] fix(unity-test-runner): inline results-check templates instead of reading from disk All matrix jobs on game-ci/unity-test-runner#310's CI were failing with ENOENT: results-check-summary.hbs, thrown after tests had already run and passed. renderSummary/renderDetails read these two tiny templates via Action.actionFolder, which resolves relative to the compiled action's own on-disk location - a path that doesn't exist for a bundled/compiled game-ci binary, since it doesn't ship the plugin's own src/**/dist/ staging layout as a sibling. Inline both templates as string constants instead, matching how small, static, non-Docker-mount text like this has no real reason to depend on filesystem path resolution at all. --- .../dist/results-check-details.hbs | 22 ++++++++++ .../dist/results-check-summary.hbs | 3 ++ .../model/results-check-templates.ts | 40 +++++++++++++++++++ .../unity-test-runner/model/results-check.ts | 9 ++--- 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 dist/unity-test-runner/dist/results-check-details.hbs create mode 100644 dist/unity-test-runner/dist/results-check-summary.hbs create mode 100644 plugins/unity/src/unity-test-runner/model/results-check-templates.ts diff --git a/dist/unity-test-runner/dist/results-check-details.hbs b/dist/unity-test-runner/dist/results-check-details.hbs new file mode 100644 index 00000000..1bd06016 --- /dev/null +++ b/dist/unity-test-runner/dist/results-check-details.hbs @@ -0,0 +1,22 @@ +{{#runs}} + +
{{summary}} + +{{#suites}} +* {{summary}} +{{#tests}} + * {{summary}} + {{#if annotation}} + {{#if annotation.message}} + {{indent annotation.message}} + {{/if}} + {{#if annotation.raw_details}} + {{indent annotation.raw_details}} + {{/if}} + {{/if}} +{{/tests}} +{{/suites}} + +
+ +{{/runs}} diff --git a/dist/unity-test-runner/dist/results-check-summary.hbs b/dist/unity-test-runner/dist/results-check-summary.hbs new file mode 100644 index 00000000..f06a1729 --- /dev/null +++ b/dist/unity-test-runner/dist/results-check-summary.hbs @@ -0,0 +1,3 @@ +{{#runs}} +### {{summary}} +{{/runs}} diff --git a/plugins/unity/src/unity-test-runner/model/results-check-templates.ts b/plugins/unity/src/unity-test-runner/model/results-check-templates.ts new file mode 100644 index 00000000..cc958085 --- /dev/null +++ b/plugins/unity/src/unity-test-runner/model/results-check-templates.ts @@ -0,0 +1,40 @@ +// Source of truth is ../views/*.hbs — keep both in sync if the templates change. +// Inlined (rather than read from disk via Action.actionFolder) because these +// two tiny templates have no reason to depend on runtime path resolution: a +// bundled/compiled game-ci binary doesn't preserve the plugin's own +// src/**/dist/ staging layout that Action.actionFolder assumes, so a +// filesystem lookup for them is fragile in exactly the context these run in +// (see game-ci/unity-test-runner#310's CI - all matrix jobs failed with an +// ENOENT for results-check-summary.hbs once the wrapper stopped shipping its +// own dist/ alongside the compiled action code). +export const RESULTS_CHECK_SUMMARY_TEMPLATE = `{{#runs}} + ### + {{summary}} +{{/runs}} +`; + +export const RESULTS_CHECK_DETAILS_TEMPLATE = `{{#runs}} + +
{{summary}} + + {{#suites}} + * + {{summary}} + {{#tests}} + * + {{summary}} + {{#if annotation}} + {{#if annotation.message}} + {{indent annotation.message}} + {{/if}} + {{#if annotation.raw_details}} + {{indent annotation.raw_details}} + {{/if}} + {{/if}} + {{/tests}} + {{/suites}} + +
+ +{{/runs}} +`; diff --git a/plugins/unity/src/unity-test-runner/model/results-check.ts b/plugins/unity/src/unity-test-runner/model/results-check.ts index 2c0defa5..4d8682a9 100644 --- a/plugins/unity/src/unity-test-runner/model/results-check.ts +++ b/plugins/unity/src/unity-test-runner/model/results-check.ts @@ -5,7 +5,7 @@ import Handlebars from 'handlebars'; import ResultsParser from './results-parser'; import { RunMeta } from './results-meta'; import path from 'path'; -import Action from './action'; +import { RESULTS_CHECK_DETAILS_TEMPLATE, RESULTS_CHECK_SUMMARY_TEMPLATE } from './results-check-templates'; const ResultsCheck = { async createCheck(artifactsPath, githubToken, checkName) { @@ -109,21 +109,20 @@ const ResultsCheck = { }, async renderSummary(runMetas) { - return ResultsCheck.render(`${Action.actionFolder}/results-check-summary.hbs`, runMetas); + return ResultsCheck.render(RESULTS_CHECK_SUMMARY_TEMPLATE, runMetas); }, async renderDetails(runMetas) { - return ResultsCheck.render(`${Action.actionFolder}/results-check-details.hbs`, runMetas); + return ResultsCheck.render(RESULTS_CHECK_DETAILS_TEMPLATE, runMetas); }, - async render(viewPath, runMetas) { + async render(source, runMetas) { Handlebars.registerHelper('indent', (toIndent) => toIndent .split('\n') .map((s) => ` ${s.replace('/github/workspace/', '')}`) .join('\n'), ); - const source = await fs.promises.readFile(viewPath, 'utf8'); const template = Handlebars.compile(source); return template( { runs: runMetas }, From 8f8d63345b23c52d038aff523772825fc71b28d1 Mon Sep 17 00:00:00 2001 From: frostebite Date: Fri, 28 Aug 2026 15:15:27 +0100 Subject: [PATCH 2/3] chore: drop stray dist/unity-test-runner static assets Not needed - the previous commit inlines both templates instead, so these copies (an earlier, superseded attempt at fixing the same issue by shipping the .hbs files alongside the binary) are dead weight. --- .../dist/results-check-details.hbs | 22 ------------------- .../dist/results-check-summary.hbs | 3 --- 2 files changed, 25 deletions(-) delete mode 100644 dist/unity-test-runner/dist/results-check-details.hbs delete mode 100644 dist/unity-test-runner/dist/results-check-summary.hbs diff --git a/dist/unity-test-runner/dist/results-check-details.hbs b/dist/unity-test-runner/dist/results-check-details.hbs deleted file mode 100644 index 1bd06016..00000000 --- a/dist/unity-test-runner/dist/results-check-details.hbs +++ /dev/null @@ -1,22 +0,0 @@ -{{#runs}} - -
{{summary}} - -{{#suites}} -* {{summary}} -{{#tests}} - * {{summary}} - {{#if annotation}} - {{#if annotation.message}} - {{indent annotation.message}} - {{/if}} - {{#if annotation.raw_details}} - {{indent annotation.raw_details}} - {{/if}} - {{/if}} -{{/tests}} -{{/suites}} - -
- -{{/runs}} diff --git a/dist/unity-test-runner/dist/results-check-summary.hbs b/dist/unity-test-runner/dist/results-check-summary.hbs deleted file mode 100644 index f06a1729..00000000 --- a/dist/unity-test-runner/dist/results-check-summary.hbs +++ /dev/null @@ -1,3 +0,0 @@ -{{#runs}} -### {{summary}} -{{/runs}} From 284ca9409079dc3fec551d095404337144477aeb Mon Sep 17 00:00:00 2001 From: frostebite Date: Fri, 28 Aug 2026 15:22:05 +0100 Subject: [PATCH 3/3] chore(unity): rebuild plugins/unity/dist for the inlined results-check templates 'bun run build' output for results-check.ts's switch to results-check-templates.ts, plus the new compiled file itself - CI's "Verify dist is up to date" gate caught this being stale. --- .../model/results-check-templates.d.ts | 2 + .../model/results-check-templates.js | 42 +++++++++++++++++++ .../model/results-check.d.ts | 2 +- .../unity-test-runner/model/results-check.js | 9 ++-- 4 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 plugins/unity/dist/unity-test-runner/model/results-check-templates.d.ts create mode 100644 plugins/unity/dist/unity-test-runner/model/results-check-templates.js diff --git a/plugins/unity/dist/unity-test-runner/model/results-check-templates.d.ts b/plugins/unity/dist/unity-test-runner/model/results-check-templates.d.ts new file mode 100644 index 00000000..ed242e00 --- /dev/null +++ b/plugins/unity/dist/unity-test-runner/model/results-check-templates.d.ts @@ -0,0 +1,2 @@ +export declare const RESULTS_CHECK_SUMMARY_TEMPLATE = "{{#runs}}\n ###\n {{summary}}\n{{/runs}}\n"; +export declare const RESULTS_CHECK_DETAILS_TEMPLATE = "{{#runs}}\n\n
{{summary}}\n\n {{#suites}}\n *\n {{summary}}\n {{#tests}}\n *\n {{summary}}\n {{#if annotation}}\n {{#if annotation.message}}\n {{indent annotation.message}}\n {{/if}}\n {{#if annotation.raw_details}}\n {{indent annotation.raw_details}}\n {{/if}}\n {{/if}}\n {{/tests}}\n {{/suites}}\n\n
\n\n{{/runs}}\n"; diff --git a/plugins/unity/dist/unity-test-runner/model/results-check-templates.js b/plugins/unity/dist/unity-test-runner/model/results-check-templates.js new file mode 100644 index 00000000..c55bbad8 --- /dev/null +++ b/plugins/unity/dist/unity-test-runner/model/results-check-templates.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.RESULTS_CHECK_DETAILS_TEMPLATE = exports.RESULTS_CHECK_SUMMARY_TEMPLATE = void 0; +// Source of truth is ../views/*.hbs — keep both in sync if the templates change. +// Inlined (rather than read from disk via Action.actionFolder) because these +// two tiny templates have no reason to depend on runtime path resolution: a +// bundled/compiled game-ci binary doesn't preserve the plugin's own +// src/**/dist/ staging layout that Action.actionFolder assumes, so a +// filesystem lookup for them is fragile in exactly the context these run in +// (see game-ci/unity-test-runner#310's CI - all matrix jobs failed with an +// ENOENT for results-check-summary.hbs once the wrapper stopped shipping its +// own dist/ alongside the compiled action code). +exports.RESULTS_CHECK_SUMMARY_TEMPLATE = `{{#runs}} + ### + {{summary}} +{{/runs}} +`; +exports.RESULTS_CHECK_DETAILS_TEMPLATE = `{{#runs}} + +
{{summary}} + + {{#suites}} + * + {{summary}} + {{#tests}} + * + {{summary}} + {{#if annotation}} + {{#if annotation.message}} + {{indent annotation.message}} + {{/if}} + {{#if annotation.raw_details}} + {{indent annotation.raw_details}} + {{/if}} + {{/if}} + {{/tests}} + {{/suites}} + +
+ +{{/runs}} +`; diff --git a/plugins/unity/dist/unity-test-runner/model/results-check.d.ts b/plugins/unity/dist/unity-test-runner/model/results-check.d.ts index f1034aed..3f721952 100644 --- a/plugins/unity/dist/unity-test-runner/model/results-check.d.ts +++ b/plugins/unity/dist/unity-test-runner/model/results-check.d.ts @@ -3,6 +3,6 @@ declare const ResultsCheck: { requestGitHubCheck(githubToken: any, checkName: any, output: any): Promise; renderSummary(runMetas: any): Promise; renderDetails(runMetas: any): Promise; - render(viewPath: any, runMetas: any): Promise; + render(source: any, runMetas: any): Promise; }; export default ResultsCheck; diff --git a/plugins/unity/dist/unity-test-runner/model/results-check.js b/plugins/unity/dist/unity-test-runner/model/results-check.js index 2efdd48f..027a6457 100644 --- a/plugins/unity/dist/unity-test-runner/model/results-check.js +++ b/plugins/unity/dist/unity-test-runner/model/results-check.js @@ -43,7 +43,7 @@ const handlebars_1 = __importDefault(require("handlebars")); const results_parser_1 = __importDefault(require("./results-parser")); const results_meta_1 = require("./results-meta"); const path_1 = __importDefault(require("path")); -const action_1 = __importDefault(require("./action")); +const results_check_templates_1 = require("./results-check-templates"); const ResultsCheck = { async createCheck(artifactsPath, githubToken, checkName) { // Validate input @@ -134,17 +134,16 @@ const ResultsCheck = { await octokit.rest.checks.create(createCheckRequest); }, async renderSummary(runMetas) { - return ResultsCheck.render(`${action_1.default.actionFolder}/results-check-summary.hbs`, runMetas); + return ResultsCheck.render(results_check_templates_1.RESULTS_CHECK_SUMMARY_TEMPLATE, runMetas); }, async renderDetails(runMetas) { - return ResultsCheck.render(`${action_1.default.actionFolder}/results-check-details.hbs`, runMetas); + return ResultsCheck.render(results_check_templates_1.RESULTS_CHECK_DETAILS_TEMPLATE, runMetas); }, - async render(viewPath, runMetas) { + async render(source, runMetas) { handlebars_1.default.registerHelper('indent', (toIndent) => toIndent .split('\n') .map((s) => ` ${s.replace('/github/workspace/', '')}`) .join('\n')); - const source = await fs.promises.readFile(viewPath, 'utf8'); const template = handlebars_1.default.compile(source); return template({ runs: runMetas }, { allowProtoMethodsByDefault: true,