Skip to content

Commit 6bced8b

Browse files
committed
claude made a gha reporter let's try it
1 parent 705e358 commit 6bced8b

File tree

3 files changed

+39
-24
lines changed

3 files changed

+39
-24
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,11 @@ jobs:
224224
- name: Install Playwright Chromium
225225
if: steps.pw-browsers-cache.outputs.cache-hit != 'true'
226226
run: npx playwright install --with-deps chromium
227-
working-directory: packages/scramjet/packages/core
228-
229-
- name: Run Playwright tests
230-
run: pnpm test:integration
231-
working-directory: packages/scramjet/packages/core
227+
working-directory: packages/scramjet/packages/runway
232228

233-
- name: Upload artifacts
234-
uses: actions/upload-artifact@v4
235-
if: always()
236-
with:
237-
name: playwright-test-results
238-
path: packages/scramjet/packages/core/blob-report/*
239-
if-no-files-found: error
229+
- name: Run Runway tests
230+
run: pnpm test
231+
working-directory: packages/scramjet/packages/runway
240232

241233
rewritertests:
242234
name: Run Rewriter Tests

packages/scramjet/.github/workflows/main.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,19 +227,11 @@ jobs:
227227
- name: Install Playwright Chromium
228228
if: steps.pw-browsers-cache.outputs.cache-hit != 'true'
229229
run: npx playwright install --with-deps chromium
230-
working-directory: packages/core
231-
232-
- name: Run Playwright tests
233-
run: pnpm test:integration
234-
working-directory: packages/core
230+
working-directory: packages/runway
235231

236-
- name: Upload artifacts
237-
uses: actions/upload-artifact@v4
238-
if: always()
239-
with:
240-
name: playwright-test-results
241-
path: packages/core/blob-report/*
242-
if-no-files-found: error
232+
- name: Run Runway tests
233+
run: pnpm test
234+
working-directory: packages/runway
243235

244236
rewritertests:
245237
name: "Run Rewriter Tests"

packages/scramjet/packages/runway/src/index.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,28 @@ import { fileURLToPath } from "node:url";
77

88
const __dirname = path.dirname(fileURLToPath(import.meta.url));
99

10+
// Check if running in GitHub Actions
11+
const isGitHubActions = process.env.GITHUB_ACTIONS === "true";
12+
13+
// GitHub Actions annotation helpers
14+
function ghaError(message: string, file?: string, line?: number) {
15+
if (!isGitHubActions) return;
16+
const params = [file && `file=${file}`, line && `line=${line}`]
17+
.filter(Boolean)
18+
.join(",");
19+
console.log(`::error ${params}::${message.replace(/\n/g, "%0A")}`);
20+
}
21+
22+
function ghaGroup(name: string) {
23+
if (!isGitHubActions) return;
24+
console.log(`::group::${name}`);
25+
}
26+
27+
function ghaEndGroup() {
28+
if (!isGitHubActions) return;
29+
console.log(`::endgroup::`);
30+
}
31+
1032
type TestResult = {
1133
status: "pass" | "fail";
1234
message?: string;
@@ -166,6 +188,7 @@ async function main() {
166188
let needsReload = true;
167189

168190
for (const test of tests) {
191+
ghaGroup(`Test: ${test.name}`);
169192
process.stdout.write(` ${test.name} ... `);
170193

171194
// Reload page if needed (first run or after failure)
@@ -193,6 +216,7 @@ async function main() {
193216
console.error(
194217
" Check that scramjet is built and all dependencies are available.\n"
195218
);
219+
ghaError(`Harness failed to initialize: ${statusText}`);
196220
await browser.close();
197221
process.exit(1);
198222
}
@@ -212,6 +236,9 @@ async function main() {
212236
if (result.message) {
213237
console.log(` ${result.message}`);
214238
}
239+
ghaError(
240+
`Test "${test.name}" failed: ${result.message || "Unknown error"}`
241+
);
215242
needsReload = true; // Reload after failure
216243
}
217244
} catch (error) {
@@ -228,8 +255,12 @@ async function main() {
228255
console.log(
229256
` ${error instanceof Error ? error.message : String(error)}`
230257
);
258+
ghaError(
259+
`Test "${test.name}" error: ${error instanceof Error ? error.message : String(error)}`
260+
);
231261
needsReload = true; // Reload after error
232262
}
263+
ghaEndGroup();
233264
}
234265

235266
testPage.cleanup();

0 commit comments

Comments
 (0)