Skip to content

Commit b6be6bc

Browse files
kitlangtonbalcsida
authored andcommitted
test(ci): publish unit reports in actions (anomalyco#20547)
1 parent 391e1ec commit b6be6bc

File tree

4 files changed

+42
-4
lines changed

4 files changed

+42
-4
lines changed

.github/workflows/test.yml

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ concurrency:
1515

1616
permissions:
1717
contents: read
18+
checks: write
1819

1920
jobs:
2021
unit:
@@ -45,14 +46,39 @@ jobs:
4546
git config --global user.email "bot@opencode.ai"
4647
git config --global user.name "opencode"
4748
49+
- name: Cache Turbo
50+
uses: actions/cache@v4
51+
with:
52+
path: node_modules/.cache/turbo
53+
key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }}
54+
restore-keys: |
55+
turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-
56+
turbo-${{ runner.os }}-
57+
4858
- name: Run unit tests
49-
run: bun turbo test
59+
run: bun turbo test:ci
5060
env:
51-
# Bun 1.3.11 intermittently crashes on Windows during test teardown
52-
# inside the native @parcel/watcher binding. Unit CI does not rely on
53-
# the live watcher backend there, so disable it for that platform.
5461
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
5562

63+
- name: Publish unit reports
64+
if: always()
65+
uses: mikepenz/action-junit-report@v6
66+
with:
67+
report_paths: packages/*/.artifacts/unit/junit.xml
68+
check_name: "unit results (${{ matrix.settings.name }})"
69+
detailed_summary: true
70+
include_time_in_summary: true
71+
fail_on_failure: false
72+
73+
- name: Upload unit artifacts
74+
if: always()
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: unit-${{ matrix.settings.name }}-${{ github.run_attempt }}
78+
if-no-files-found: ignore
79+
retention-days: 7
80+
path: packages/*/.artifacts/unit/junit.xml
81+
5682
e2e:
5783
name: e2e (${{ matrix.settings.name }})
5884
strategy:

packages/app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"build": "vite build",
1616
"serve": "vite preview",
1717
"test": "bun run test:unit",
18+
"test:ci": "bun test --preload ./happydom.ts ./src --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml",
1819
"test:unit": "bun test --preload ./happydom.ts ./src",
1920
"test:unit:watch": "bun test --watch --preload ./happydom.ts ./src",
2021
"test:e2e": "playwright test",

packages/opencode/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"prepare": "effect-language-service patch || true",
1010
"typecheck": "tsgo --noEmit",
1111
"test": "bun test --timeout 30000",
12+
"test:ci": "bun test --timeout 30000 --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml",
1213
"build": "bun run script/build.ts",
1314
"upgrade-opentui": "bun run script/upgrade-opentui.ts",
1415
"dev": "bun run --conditions=browser ./src/index.ts",

turbo.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,19 @@
1313
"outputs": [],
1414
"passThroughEnv": ["*"]
1515
},
16+
"opencode#test:ci": {
17+
"dependsOn": ["^build"],
18+
"outputs": [".artifacts/unit/junit.xml"],
19+
"passThroughEnv": ["*"]
20+
},
1621
"@opencode-ai/app#test": {
1722
"dependsOn": ["^build"],
1823
"outputs": []
24+
},
25+
"@opencode-ai/app#test:ci": {
26+
"dependsOn": ["^build"],
27+
"outputs": [".artifacts/unit/junit.xml"],
28+
"passThroughEnv": ["*"]
1929
}
2030
}
2131
}

0 commit comments

Comments
 (0)