Measure test coverage, upload it to Codecov, show it in the README - #577
Merged
Merged
Conversation
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
whes1015
force-pushed
the
ci/test-coverage
branch
from
September 17, 2026 20:41
bfd9aff to
72990ba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
這個 PR 做了什麼
測試覆蓋率有了固定的量法和公開的呈現:產生的程式碼用 Dart 標準的
// coverage:ignore-file排除,tool/dev/coverage.sh跑整套測試並量lib/的行覆蓋率,CI 上傳到 Codecov,README 顯示徽章與旭日圖。
相關 issue
怎麼驗
合併前需要先啟用 Codecov:到 https://app.codecov.io/gh 用 GitHub 登入、授權
ExpTechTW並啟用這個 repo,再安裝 Codecov 的 GitHub App(PR 留言與狀態檢查靠它)。在那之前 CI 的上傳步驟會失敗但不會讓 CI 變紅,
README 的旭日圖會是 404、徽章顯示 unknown。上傳用 OIDC,不需要任何 secret。
tool/dev/coverage.sh→coverage/lcov.info;本機裝了 lcov(brew install lcov)還會產生
coverage/html/index.html。目前是 55.9%、32,985 行、449 個檔案。grep -c '\.g\.dart' coverage/lcov.info→0:產生的程式碼不在報告裡。把任何一個.g.dart或lib/l10n/gen/檔案開頭的// coverage:ignore-file刪掉,tool/dev/test.sh test/tool/generated_code_coverage_test.dart會失敗並點名那個檔案和該跑的重新產生指令。
tool/check.sh的測試步驟就是這支腳本,和 CI 同一份;樹沒變就走快取。資料夾與檔案的覆蓋率條,檔案總管顯示百分比。那是 Dart 擴充自己跑的一輪,沒有
import 沒被測到的檔案,所以數字會比報告略高,這是預期的。
安全關鍵的部分沒有被碰到:這個 PR 不改任何
lib/手寫程式碼,只有產生器設定、重新產生的檔案、工具腳本、CI 與文件。
檢查清單
tool/check/commits.sh origin/main..HEAD通過tool/dev/analyze.sh與tool/dev/coverage.sh通過(1870 個測試)