-
Notifications
You must be signed in to change notification settings - Fork 1
Codecovを追加し、テストカバレッジを計測できるように変更 #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughCI workflow now runs Vitest with coverage and uploads results to Codecov. Firebase Functions package adds coverage plugin and bumps Vitest. Workspace dictionary updated to include “vitest”. Deployment step remains functionally unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub Actions
participant Test as Vitest
participant CC as Codecov
participant Firebase as Firebase Deploy
Dev->>GH: Push/PR triggers reusable workflow
GH->>Test: Run npx vitest run --coverage
alt Tests pass
GH->>CC: Upload coverage reports (codecov-action@v5)
GH->>Firebase: Run deploy step
else Tests fail
GH-->>Dev: Report failure (no deploy, no upload)
end
%% Styling hints (labels used alongside color)
rect rgba(200,230,255,0.2)
Note over GH,Test: New/changed: Vitest with coverage
end
rect rgba(220,255,220,0.2)
Note over GH,CC: New: Codecov upload step
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
openci-runner/firebase/functions/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
.github/workflows/reusable-deploy-firebase-functions.yml(1 hunks)openci-runner/firebase/functions/package.json(1 hunks)openci.code-workspace(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/reusable-deploy-firebase-functions.yml
38-38: property "codecov_token" is not defined in object type {actions_runner_debug: string; actions_step_debug: string; firebase_project_id: string; gha_service_account: string; github_token: string}
(expression)
🔇 Additional comments (3)
openci.code-workspace (1)
77-78: LGTM!スペルチェッカーの辞書に"vitest"を追加し、"validkey"にトレーリングカンマを付けることで、今後のメンテナンスが容易になります。Vitestテストフレームワークの導入と整合性が取れています。
openci-runner/firebase/functions/package.json (2)
27-27: LGTM!カバレッジプラグイン
@vitest/coverage-v8の追加により、CI環境でのコードカバレッジ測定が可能になります。バージョン ^1.6.1 は、更新されたvitestのバージョンと一致しており、適切です。
32-32: LGTM!Vitestのバージョンを ^1.6.0 から ^1.6.1 へ更新することで、カバレッジプラグインとの互換性が保証されます。パッチバージョンのアップデートなので、破壊的変更のリスクは最小限です。
| - name: Test | ||
| run: npm test | ||
| run: npx vitest run --coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
カバレッジ設定の確認を推奨します
Vitestカバレッジコマンドは正しく実装されていますが、vitest.config.tsまたはvitest.config.jsファイルでカバレッジ設定(カバレッジプロバイダー、対象ディレクトリ、除外パターンなど)が適切に定義されているか確認してください。
以下のスクリプトを実行してVitest設定ファイルの存在を確認してください:
🏁 Script executed:
#!/bin/bash
# Description: Vitest設定ファイルとカバレッジ設定の確認
# Vitest設定ファイルの検索
fd -t f 'vitest.config\.(ts|js|mts|mjs)' openci-runner/firebase/functions
# 設定ファイルが見つかった場合、カバレッジ設定を確認
if fd -t f 'vitest.config\.(ts|js|mts|mjs)' openci-runner/firebase/functions | grep -q .; then
echo "=== Vitest設定ファイルの内容 ==="
fd -t f 'vitest.config\.(ts|js|mts|mjs)' openci-runner/firebase/functions --exec cat {}
fiLength of output: 0
🏁 Script executed:
#!/bin/bash
# リポジトリ全体で Vitest 設定ファイルを検索
fd -t f 'vitest.config\.(ts|js|mts|mjs)' .
# ファイルが見つかった場合、その内容を表示
if fd -t f 'vitest.config\.(ts|js|mts|mjs)' . | grep -q .; then
echo "=== Vitest設定ファイルの内容 ==="
fd -t f 'vitest.config\.(ts|js|mts|mjs)' . --exec cat {}
else
echo "Vitest設定ファイルが見つかりませんでした。"
echo "カバレッジ設定キーワードを検索します:"
rg -n 'coverage' --glob='*.config.*'
fiLength of output: 193
Vitest設定ファイルの追加とカバレッジ設定の明示化 プロジェクトルートにvitest.config.ts(または.js)を作成し、coverage.provider、include、excludeなどのカバレッジ設定を定義してください。
🤖 Prompt for AI Agents
.github/workflows/reusable-deploy-firebase-functions.yml around lines 32-33: the
workflow calls "npx vitest run --coverage" but the project lacks a vitest.config
file specifying coverage options; create a vitest.config.ts (or .js) at the repo
root and export configuration that explicitly sets coverage.provider (e.g., 'c8'
or 'v8'), coverage.include (globs for source files to measure), coverage.exclude
(tests, mocks, build outputs), and any thresholds or reporter settings required
by CI, then commit that config so the workflow's --coverage run uses the defined
settings.
| - name: Upload results to Codecov | ||
| uses: codecov/codecov-action@v5 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CODECOV_TOKENシークレットの宣言が不足しています
ワークフローでは secrets.CODECOV_TOKEN を参照していますが、ファイル冒頭の workflow_call.secrets セクション(3-7行目)で宣言されていません。これによりワークフローの実行が失敗するか、カバレッジのアップロードが機能しません。
次のdiffを適用してシークレット宣言を追加してください:
on:
workflow_call:
secrets:
gha_service_account:
required: true
firebase_project_id:
required: true
+ codecov_token:
+ required: true📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - name: Upload results to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| on: | |
| workflow_call: | |
| secrets: | |
| gha_service_account: | |
| required: true | |
| firebase_project_id: | |
| required: true | |
| codecov_token: | |
| required: true |
🧰 Tools
🪛 actionlint (1.7.7)
38-38: property "codecov_token" is not defined in object type {actions_runner_debug: string; actions_step_debug: string; firebase_project_id: string; gha_service_account: string; github_token: string}
(expression)
🤖 Prompt for AI Agents
.github/workflows/reusable-deploy-firebase-functions.yml lines ~3-7: the
workflow references secrets.CODECOV_TOKEN later but that secret is not declared
in the workflow_call.secrets block at the top; update the workflow_call.secrets
section to include CODECOV_TOKEN (mark as required) so the secret is exposed to
callers and available when the Codecov upload step runs.
Summary by CodeRabbit