Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
branches:
- master

permissions:
contents: read
pull-requests: write

jobs:
android:
name: Android
Expand All @@ -23,6 +27,18 @@ jobs:
- name: Lint & Test
run: ./gradlew :app:check

- name: Generate Kotlin coverage XML
run: ./gradlew :app:koverXmlReport

- name: Comment coverage on PR
if: github.event_name == 'pull_request'
uses: madrapps/jacoco-report@v1.7.1
with:
paths: ${{ github.workspace }}/app/build/reports/kover/report.xml
token: ${{ secrets.GITHUB_TOKEN }}
title: Kotlin Coverage
update-comment: true

bridge:
name: Bridge
runs-on: ubuntu-latest
Expand All @@ -49,3 +65,53 @@ jobs:

- name: Lint, Typecheck & Test
run: pnpm check

- name: Generate bridge coverage
run: pnpm run test:coverage

- name: Build bridge coverage PR comment
if: github.event_name == 'pull_request'
run: |
node <<'NODE'
const fs = require('node:fs');

const summaryPath = 'coverage/coverage-summary.json';
if (!fs.existsSync(summaryPath)) {
throw new Error(`Coverage summary not found at ${summaryPath}`);
}

const summary = JSON.parse(fs.readFileSync(summaryPath, 'utf8'));
const total = summary.total ?? {};

const metricRow = (key, label) => {
const metric = total[key] ?? { covered: 0, total: 0, pct: 0 };
const covered = Number(metric.covered ?? 0);
const totalCount = Number(metric.total ?? 0);
const pct = Number(metric.pct ?? 0).toFixed(2);
return `| ${label} | ${covered} / ${totalCount} | ${pct}% |`;
};

const markdown = [
'## Bridge Coverage (Vitest)',
'',
'| Metric | Covered / Total | Coverage |',
'|---|---:|---:|',
metricRow('lines', 'Lines'),
metricRow('functions', 'Functions'),
metricRow('branches', 'Branches'),
metricRow('statements', 'Statements'),
'',
'_Source: bridge/coverage/coverage-summary.json_',
'',
].join('\n');

fs.mkdirSync('coverage', { recursive: true });
fs.writeFileSync('coverage/pr-comment.md', markdown);
NODE

- name: Comment bridge coverage on PR
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: bridge-coverage
path: bridge/coverage/pr-comment.md
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("org.jetbrains.kotlin.plugin.serialization")
id("org.jetbrains.kotlinx.kover")
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ class ChatViewModelThinkingExpansionTest {
},
),
)
dispatcher.scheduler.advanceUntilIdle()

waitForState(viewModel) { state ->
val assistants = state.timeline.filterIsInstance<ChatTimelineItem.Assistant>()
assistants.size == 1 && assistants.single().text == "New"
}

val item = viewModel.singleAssistantItem()
assertEquals("New", item.text)
Expand Down
4 changes: 3 additions & 1 deletion bridge/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "eslint .",
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:coverage": "vitest run --coverage.enabled --coverage.provider=v8 --coverage.reporter=text-summary --coverage.reporter=lcov --coverage.reporter=json-summary",
"check": "pnpm run lint && pnpm run typecheck && pnpm run test"
},
"dependencies": {
Expand All @@ -25,6 +26,7 @@
"tsx": "^4.20.5",
"typescript": "^5.9.2",
"typescript-eslint": "^8.45.0",
"vitest": "^3.2.4"
"vitest": "^3.2.4",
"@vitest/coverage-v8": "^3.2.4"
}
}
Loading