Compare commits

...

4 Commits

Author SHA1 Message Date
Kit Langton
ccdc34b3b4 test(ci): add checks permission, turbo cache, dual reporters
- Add checks: write so junit-report can create check runs
- Add turbo cache step to skip unchanged build dependencies
- Use dual reporters (default + junit) for readable console output
- Replace annotate_only with check_name for proper check runs
- Guard set -o pipefail for Windows compatibility
2026-04-01 20:44:42 -04:00
Kit Langton
9054f6a262 Merge branch 'dev' into kit/ci-unit-reporting 2026-04-01 20:07:39 -04:00
Kit Langton
7df330a37a test(ci): avoid duplicate unit checks 2026-04-01 19:02:29 -04:00
Kit Langton
7af6573e07 test(ci): publish unit reports in actions 2026-04-01 16:15:12 -04:00
4 changed files with 71 additions and 2 deletions

View File

@@ -15,10 +15,11 @@ concurrency:
permissions:
contents: read
checks: write
jobs:
unit:
name: unit (${{ matrix.settings.name }})
name: unit (${{ matrix.settings.name }}, ${{ matrix.pkg.name }})
strategy:
fail-fast: false
matrix:
@@ -27,6 +28,15 @@ jobs:
host: blacksmith-4vcpu-ubuntu-2404
- name: windows
host: blacksmith-4vcpu-windows-2025
pkg:
- id: opencode
name: opencode
dir: packages/opencode
filter: opencode
- id: app
name: app
dir: packages/app
filter: "@opencode-ai/app"
runs-on: ${{ matrix.settings.host }}
defaults:
run:
@@ -45,8 +55,55 @@ 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: |
[[ "$RUNNER_OS" != "Windows" ]] && set -o pipefail || true
mkdir -p ".artifacts/unit/${{ matrix.pkg.id }}" "${{ matrix.pkg.dir }}/.artifacts/unit"
bunx turbo run test:ci --filter="${{ matrix.pkg.filter }}" --log-order=grouped --output-logs=full \
2>&1 | tee ".artifacts/unit/${{ matrix.pkg.id }}/turbo.log"
- name: Check unit report
if: always()
id: report
run: |
if [ -f "${{ matrix.pkg.dir }}/.artifacts/unit/junit.xml" ]; then
echo "found=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "found=false" >> "$GITHUB_OUTPUT"
echo "### Unit report unavailable" >> "$GITHUB_STEP_SUMMARY"
echo "Turbo did not produce JUnit output for ${{ matrix.pkg.name }} on ${{ matrix.settings.name }}." >> "$GITHUB_STEP_SUMMARY"
- name: Publish unit report
if: always() && steps.report.outputs.found == 'true'
uses: mikepenz/action-junit-report@v6
with:
report_paths: ${{ matrix.pkg.dir }}/.artifacts/unit/junit.xml
check_name: "unit (${{ matrix.settings.name }}, ${{ matrix.pkg.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 }}-${{ matrix.pkg.id }}-${{ github.run_attempt }}
if-no-files-found: ignore
retention-days: 7
path: |
.artifacts/unit/${{ matrix.pkg.id }}/turbo.log
${{ matrix.pkg.dir }}/.artifacts/unit/junit.xml
e2e:
name: e2e (${{ matrix.settings.name }})

View File

@@ -15,6 +15,7 @@
"build": "vite build",
"serve": "vite preview",
"test": "bun run test:unit",
"test:ci": "bun test --preload ./happydom.ts ./src --reporter=default --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",

View File

@@ -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=default --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",

View File

@@ -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": ["*"]
}
}
}