From d2cfd8ce2aca7468a43dd0ee40dd416a5c16328e Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 1 Apr 2026 16:15:12 -0400 Subject: [PATCH] test(ci): publish unit reports in actions --- .github/workflows/test.yml | 34 ++++++++++++++++++++++++++++++---- packages/app/package.json | 1 + packages/opencode/package.json | 1 + turbo.json | 10 ++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 803093fc5953..119d652ae965 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,7 @@ concurrency: permissions: contents: read + checks: write jobs: unit: @@ -45,14 +46,39 @@ jobs: git config --global user.email "bot@opencode.ai" git config --global user.name "opencode" + - name: Cache Turbo + uses: actions/cache@v4 + with: + path: node_modules/.cache/turbo + key: turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}-${{ github.sha }} + restore-keys: | + turbo-${{ runner.os }}-${{ hashFiles('turbo.json', '**/package.json') }}- + turbo-${{ runner.os }}- + - name: Run unit tests - run: bun turbo test + run: bun turbo test:ci env: - # Bun 1.3.11 intermittently crashes on Windows during test teardown - # inside the native @parcel/watcher binding. Unit CI does not rely on - # the live watcher backend there, so disable it for that platform. OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }} + - name: Publish unit reports + if: always() + uses: mikepenz/action-junit-report@v6 + with: + report_paths: packages/*/.artifacts/unit/junit.xml + check_name: "unit results (${{ matrix.settings.name }})" + detailed_summary: true + include_time_in_summary: true + fail_on_failure: false + + - name: Upload unit artifacts + if: always() + uses: actions/upload-artifact@v4 + with: + name: unit-${{ matrix.settings.name }}-${{ github.run_attempt }} + if-no-files-found: ignore + retention-days: 7 + path: packages/*/.artifacts/unit/junit.xml + e2e: name: e2e (${{ matrix.settings.name }}) strategy: diff --git a/packages/app/package.json b/packages/app/package.json index d179e4a52415..62749e209a2a 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -15,6 +15,7 @@ "build": "vite build", "serve": "vite preview", "test": "bun run test:unit", + "test:ci": "bun test --preload ./happydom.ts ./src --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml", "test:unit": "bun test --preload ./happydom.ts ./src", "test:unit:watch": "bun test --watch --preload ./happydom.ts ./src", "test:e2e": "playwright test", diff --git a/packages/opencode/package.json b/packages/opencode/package.json index b64cc1922ed1..96c7612e828f 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -9,6 +9,7 @@ "prepare": "effect-language-service patch || true", "typecheck": "tsgo --noEmit", "test": "bun test --timeout 30000", + "test:ci": "bun test --timeout 30000 --reporter=junit --reporter-outfile=.artifacts/unit/junit.xml", "build": "bun run script/build.ts", "upgrade-opentui": "bun run script/upgrade-opentui.ts", "dev": "bun run --conditions=browser ./src/index.ts", diff --git a/turbo.json b/turbo.json index cff3381ecb7d..28c2fa2de0d2 100644 --- a/turbo.json +++ b/turbo.json @@ -13,9 +13,19 @@ "outputs": [], "passThroughEnv": ["*"] }, + "opencode#test:ci": { + "dependsOn": ["^build"], + "outputs": [".artifacts/unit/junit.xml"], + "passThroughEnv": ["*"] + }, "@opencode-ai/app#test": { "dependsOn": ["^build"], "outputs": [] + }, + "@opencode-ai/app#test:ci": { + "dependsOn": ["^build"], + "outputs": [".artifacts/unit/junit.xml"], + "passThroughEnv": ["*"] } } }