Replace this temporary ReportGenerator/.NET dependency with grcov
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 55/100
- Issue 類型
- 重構
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- github-actions, javascript
研究方向
Start with the coverage preparation and finish logic in actions/quality/prepare-ci-reports/action.yml, including the referenced dist/index.js implementation. Check whether the specified grcov releases support the required LCOV branch counts and Cobertura and Clover inputs, then validate the existing report contract. Done when coverage normalization uses grcov in place of the ReportGenerator/.NET steps and the report contract is validated.
由索引模型根據 Issue 內容生成。
描述
after these changes are released and the report contract is validated:
https://github\.com/mozilla/grcov/pull/1568 (LCOV branch counts)
https://github\.com/mozilla/grcov/pull/1569 (Cobertura and Clover XML inputs).
v6.1.0
# Convert supported native reports with upstream tools and retain one artifact.
# Language actions call this after their command, including failures.
# See the [publication workflow](../../../.github/workflows/publish-ci-reports.md)
# for destinations, permissions, summaries and comments.
#
# ## Custom commands
#
# Run the command in its normal workflow step and prepare its reports afterwards.
# Use a fresh directory owned by that execution. The preparation step still runs
# when the command fails, so diagnostic reports remain available.
#
# ```yaml
# - id: report-directory
# shell: bash
# run: echo "path=$(mktemp -d "$RUNNER_TEMP/integration-reports.XXXXXX")" >> "$GITHUB_OUTPUT"
# - id: integration
# working-directory: application
# env:
# CI_REPORTS_DIR: ${{ steps.report-directory.outputs.path }}
# run: ./scripts/integration-tests
# - uses: hoverkraft-tech/ci-github-common/actions/quality/prepare-ci-reports@d22d9532441a353f54431721affbf3ec7874034b # PR #683
# if: ${{ !cancelled() && steps.report-directory.outcome == 'success' }}
# with:
# directory: ${{ steps.report-directory.outputs.path }}
# outcome: ${{ steps.integration.outcome }}
# definition: |
# {
# "name": "Integration tests",
# "project": "application",
# "reports": [{"kind": "test"}]
# }
# - name: Clean integration report directory
# if: ${{ always() && steps.report-directory.outputs.path != '' }}
# env:
# REPORT_DIRECTORY: ${{ steps.report-directory.outputs.path }}
# run: rm -rf -- "$REPORT_DIRECTORY"
# ```
#
# Write supported native outputs under `CI_REPORTS_DIR`. Required missing, malformed
# or empty reports fail the producer. Selected native files and valid converted
# results are retained after failures; unrelated files are not uploaded.
#
# ## Provider action contract
#
# The provider owns command execution and a fresh output directory. After the
# command, including failure, call `actions/quality/prepare-ci-reports` with:
#
# - `directory`: the directory populated by this command.
# - `outcome`: the command's actual step outcome.
# - `definition`: JSON containing `name`, repository-relative `project`, optional
# `variant`, and `reports` selectors.
#
# ```json
# {
# "name": "Python tests",
# "project": "services/api",
# "variant": { "runtime": "3.14" },
# "reports": [{ "kind": "test" }, { "kind": "coverage", "language": "Python" }]
# }
# ```
#
# The language action declares required kinds, not filenames. Preparation discovers
# supported JSON, XML, SARIF and LCOV reports recursively in the command's fresh
# directory. A combined Jest/Vitest report supplies tests and coverage and is
# retained once. Missing required kinds or malformed report files fail preparation;
# other valid evidence remains available. Coverage HTML and other ancillary outputs
# are ignored. The publisher receives the same normalized artifact contract.
#
# A custom producer may use a `pattern` to narrow selection, relative to its fresh
# directory, or a `format` for another Reviewdog-supported format. Those are provider
# implementation details, not language workflow inputs. Paths cannot escape through
# traversal or symlinks. Each selected file must be nonempty and at most 100 MiB.
# Source paths for tests and lint are resolved inside the checkout. A
# `path-mapping` object can map container prefixes to repository-relative paths;
# prebuilt source must match the workflow commit.
#
# | Evidence | Supported inputs | Maintained conversion |
# | -------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------- |
# | Tests | JUnit, CTRF, Jest/Vitest JSON | JUnit-to-CTRF, Jest JUnit reporter and CTRF schema validation |
# | Lint | SARIF, Checkstyle, ESLint JSON, named Reviewdog formats | Reviewdog and Microsoft's ESLint SARIF formatter |
# | Coverage | Cobertura, LCOV, Clover and ReportGenerator-supported coverage XML; Istanbul JSON or Jest/Vitest coverageMap | ReportGenerator and Istanbul |
#
# Astro diagnostics use a Reviewdog errorformat. The native Super-Linter Markdown
# summary is retained directly; Super-Linter continues to own its annotations.
# CodeQL keeps its own code-scanning results.
#
# A Jest/Vitest JSON file containing `coverageMap` can be selected for both
# tests and coverage. Clover supplies coverage, not test outcomes. Go's provider
# uses gocover-cobertura to convert its native profile before normalization.
#
# The uploaded artifact contains a small `report.json` manifest, normalized CTRF
# and Reviewdog JSON, normalized coverage, and selected native evidence. The
# publisher consumes these standard outputs without reparsing native formats.
# Normalized coverage uses repository-relative file identities so files with the
# same basename in different projects remain separate when merged.
name: Prepare CI reports
description: Validate and normalize test, lint and coverage reports for consolidated publication.
author: hoverkraft
branding:
icon: file-text
color: blue
inputs:
directory:
description: Fresh report directory populated by the producer command.
required: true
definition:
description: JSON name, project, variant and required report kinds, with optional coverage language. Supported native files are discovered automatically; a pattern can narrow selection for custom producers.
required: true
outcome:
description: Actual producer command outcome (success, failure or cancelled).
required: true
outputs:
artifact-id:
description: Report artifact ID, discovered automatically by the publication workflow.
value: ${{ steps.upload.outputs.artifact-id }}
runs:
using: composite
steps:
- uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
if: contains(inputs.definition, '"lint"')
with:
reviewdog_version: v0.21.3
- id: prepare
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ACTION_PATH: ${{ github.action_path }}
REPORT_DIRECTORY: ${{ inputs.directory }}
DEFINITION: ${{ inputs.definition }}
OUTCOME: ${{ inputs.outcome }}
with:
script: |
const { PrepareReports } = await import(require('node:url').pathToFileURL(`${process.env.ACTION_PATH}/dist/index.js`));
await new PrepareReports({core, exec, context}).prepare({
directory: process.env.REPORT_DIRECTORY, definition: process.env.DEFINITION,
outcome: process.env.OUTCOME, workspace: process.env.GITHUB_WORKSPACE,
temporaryDirectory: process.env.RUNNER_TEMP,
});
# FIXME: Replace this temporary ReportGenerator/.NET dependency with grcov
# after these changes are released and the report contract is validated:
# https://github.com/mozilla/grcov/pull/1568 (LCOV branch counts)
# https://github.com/mozilla/grcov/pull/1569 (Cobertura and Clover XML inputs).
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
if: steps.prepare.outputs.coverage != ''
with:
dotnet-version: "10.0.x"
- name: Normalize coverage with ReportGenerator
id: coverage
if: steps.prepare.outputs.coverage != ''
uses: danielpalme/ReportGenerator-GitHub-Action@70c37c4d588cff5bf9cf190830c6f01dfcfb884b # 5.6.1
with:
reports: ${{ steps.prepare.outputs.coverage }}
targetdir: ${{ steps.prepare.outputs.directory }}/coverage
toolpath: ${{ runner.temp }}/reportgenerator-5.6.1
reporttypes: Cobertura;JsonSummary
sourcedirs: ${{ steps.prepare.outputs.source-directory }};${{ github.workspace }}
- id: finish
if: ${{ !cancelled() && steps.prepare.outputs.directory != '' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ACTION_PATH: ${{ github.action_path }}
REPORT_DIRECTORY: ${{ steps.prepare.outputs.directory }}
COVERAGE_OUTCOME: ${{ steps.coverage.outcome }}
SOURCE_DIRECTORY: ${{ steps.prepare.outputs.source-directory }}
with:
script: |
const { PrepareReports } = await import(require('node:url').pathToFileURL(`${process.env.ACTION_PATH}/dist/index.js`));
await new PrepareReports({core, exec, context}).finish(process.env.REPORT_DIRECTORY, process.env.COVERAGE_OUTCOME, `${process.env.RUNNER_TEMP}/reportgenerator-5.6.1/reportgenerator`, process.env.SOURCE_DIRECTORY);
- id: upload
if: ${{ !cancelled() && steps.finish.outcome == 'success' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ${{ steps.prepare.outputs.artifact-name }}
path: ${{ steps.prepare.outputs.directory }}
if-no-files-found: error
retention-days: 7
- name: Enforce producer result and clean staging
if: ${{ always() && steps.prepare.outputs.directory != '' }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
REPORT_DIRECTORY: ${{ steps.prepare.outputs.directory }}
ERRORS: ${{ steps.finish.outputs.errors }}
OUTCOME: ${{ inputs.outcome }}
REPORT_FAILED: ${{ steps.finish.outputs.failed }}
with:
script: |
await io.rmRF(process.env.REPORT_DIRECTORY);
const errors = JSON.parse(process.env.ERRORS || '[]');
if (errors.length) core.setFailed(errors.join('\n'));
if (process.env.OUTCOME !== 'success') core.setFailed(`Producer command ${process.env.OUTCOME}. See its logs and retained reports.`);
if (process.env.REPORT_FAILED === 'true') core.setFailed('The retained report contains failed checks.');
- 主要語言
- JavaScript
- 星號
- 5
- 分支
- 1
- 平均合併
- 5 小時 25 分鐘
- 30 天內合併 PR
- 60
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 沒有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
hoverkraft-tech/ci-github-common 的其他 Issue
-
bug need-fix
難度 2/5 1-3 小時 新手友好度 73/100
hoverkraft-tech/ci-github-common#694 ·
維護者通常 1 天內回覆
-
bug need-fix
難度 1/5 1 小時以內 新手友好度 76/100
hoverkraft-tech/ci-github-common#691 ·
維護者通常 1 天內回覆
-
bug need-fix
難度 2/5 1-3 小時 新手友好度 65/100
hoverkraft-tech/ci-github-common#690 ·
維護者通常 1 天內回覆
-
bug need-fix
難度 1/5 1 小時以內 新手友好度 83/100
hoverkraft-tech/ci-github-common#688 ·
維護者通常 1 天內回覆
-
bug need-fix
難度 3/5 1-2 天 新手友好度 48/100
hoverkraft-tech/ci-github-common#695 ·
維護者通常 1 天內回覆
查看 hoverkraft-tech/ci-github-common 的全部 Issue
相似的 Issue
-
難度 1/5 1 小時以內 新手友好度 83/100
TheOdinProject/curriculum#31596 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100
mailcow/mailcow-dockerized#7725 ·
維護者通常 1 天內回覆
-
難度 1/5 1 小時以內 新手友好度 94/100
solana-foundation/solana-com#2579 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 85/100
vercel-labs/agent-skills#385 ·
-
documentation good first issue
難度 1/5 1-3 小時 新手友好度 88/100
danielcuesta007/skeptic#73 ·
維護者通常 1 天內回覆