Remove this ReportGenerator/.NET merge workaround after grcov ships

Aperta
#695 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
48/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
github-actions, javascript
Ambito
ci-cd, devops

Direzione di ricerca

Start with the coverage steps in actions/quality/publish-ci-reports/action.yml, especially the ReportGenerator merge and coverage upload matrix preparation. Read the linked grcov pull requests and check whether their changes are available in a release; then verify merged coverage and publication outputs against the report contract. Done means the workaround is removed and coverage publication still meets that contract.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug need-fix

https://github\.com/mozilla/grcov/pull/1568 and

https://github\.com/mozilla/grcov/pull/1569, and merged coverage plus

publication outputs have been validated against the report contract.

v6.1.0

https://github.com/hoverkraft-tech/ci-github-common/blob/3d85e6252a0c3c45c34d6f5d50db140944f61b85/actions/quality/publish-ci-reports/action.yml#L122-L126


# Gather normalized reports, publish lint/test annotations, and prepare publication files.
# The [publication workflow](../../../.github/workflows/publish-ci-reports.md)
# owns coverage uploads and final summary/comment delivery.
# Every writable PR gets a compact overview. The comment reporters add category
# diagnostics; the Actions summary always retains all details.
# Check out the tested source before calling this action; the reusable workflow does so.
name: Publish CI reports
description: Prepare consolidated report files and coverage uploads, and publish lint/test annotations.
author: hoverkraft
branding:
  icon: bar-chart-2
  color: blue
inputs:
  job-results:
    description: JSON needs context used to display producer job outcomes.
    required: true
  lint-reporters:
    description: Newline-separated `annotations`, `comment` and `code-scanning`. Comment adds lint diagnostics to the PR overview.
    default: annotations
  test-results-reporters:
    description: Newline-separated `annotations` and `comment`. Comment adds test diagnostics to the PR overview.
    default: annotations
  test-coverage-reporters:
    description: Newline-separated `auto`, `github`, `codecov`, `coveralls` and `comment`. Auto uses GitHub when available and falls back to the comment without an external provider. Comment explicitly includes coverage alongside any provider.
    default: auto
outputs:
  artifact-id:
    description: Artifact containing report Markdown and prepared coverage files.
    value: ${{ steps.upload.outputs.artifact-id }}
  coverage-matrix:
    description: JSON include matrix of selected coverage providers, languages, labels and artifact-relative files.
    value: ${{ steps.coverage-plan.outputs.matrix || '{"include":[]}' }}
  upload-coverage:
    description: Whether the coverage matrix contains uploads.
    value: ${{ steps.coverage-plan.outputs.upload || 'false' }}
  summary-file:
    description: Artifact-relative path to the rendered summary.
    value: ${{ steps.render.outputs.summary-file }}
  comment-file:
    description: Artifact-relative path to the rendered PR comment.
    value: ${{ steps.render.outputs.comment-file }}
  comment:
    description: Whether this run can publish its PR overview. The workflow checks freshness before publishing.
    value: ${{ steps.collect.outputs.comment }}
  header:
    description: Stable comment identity for this workflow.
    value: ${{ steps.collect.outputs.header }}
runs:
  using: composite
  steps:
    - id: directory
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      with:
        script: |
          const fs = require('node:fs');
          const root = fs.mkdtempSync(require('node:path').join(process.env.RUNNER_TEMP, 'publish-ci-reports-'));
          await io.mkdirP(root + '/incoming');
          await io.mkdirP(root + '/publication');
          core.setOutput('publication-path', root + '/publication');
          core.setOutput('path', root);
    - id: artifacts
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      with:
        script: |
          const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, {...context.repo,run_id:context.runId,per_page:100});
          core.setOutput('ids', artifacts.filter(artifact => artifact.name.startsWith('ci-report-') && !artifact.expired).map(artifact => artifact.id).join(','));
    - id: download
      if: steps.artifacts.outputs.ids != ''
      uses: $/actions/download-artifact
      with:
        artifact-ids: ${{ steps.artifacts.outputs.ids }}
        path: ${{ steps.directory.outputs.path }}/incoming
    - id: collect
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      env:
        ACTION_PATH: ${{ github.action_path }}
        REPORT_DIRECTORY: ${{ steps.directory.outputs.path }}
        JOB_RESULTS: ${{ inputs.job-results }}
        LINT: ${{ inputs.lint-reporters }}
        TESTS: ${{ inputs.test-results-reporters }}
        COVERAGE: ${{ inputs.test-coverage-reporters }}
      with:
        script: |
          const { CollectReports } = await import(require('node:url').pathToFileURL(`${process.env.ACTION_PATH}/dist/index.js`));
          await new CollectReports({core, github, context}).collect({directory:process.env.REPORT_DIRECTORY,jobResults:process.env.JOB_RESULTS,lint:process.env.LINT,tests:process.env.TESTS,coverage:process.env.COVERAGE});
    - uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
      if: steps.collect.outputs.lint == 'true'
      with:
        reviewdog_version: v0.21.3
    - id: lint
      if: steps.collect.outputs.lint == 'true'
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      env:
        ACTION_PATH: ${{ github.action_path }}
        REPORT_DIRECTORY: ${{ steps.directory.outputs.path }}
      with:
        script: |
          const { LintPublication } = await import(require('node:url').pathToFileURL(`${process.env.ACTION_PATH}/dist/index.js`));
          await new LintPublication({core, exec}).lint(process.env.REPORT_DIRECTORY);
    - name: Publish code scanning
      id: code-scanning
      if: ${{ !cancelled() && steps.lint.outputs.sarif != '' }}
      uses: github/codeql-action/upload-sarif@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
      with:
        sarif_file: ${{ steps.lint.outputs.sarif }}
        category: ci-lint
        wait-for-processing: true
    - id: tests
      if: ${{ !cancelled() && steps.collect.outputs.tests == 'true' }}
      uses: ctrf-io/github-test-reporter@c2e2997afb89a9a515d83121ce7499e272630446 # v1.4.0
      with:
        report-path: ${{ steps.directory.outputs.path }}/tests/*.json
        summary-report: false
        failed-folded-report: true
        summary: false
        pull-request: false
        annotate: ${{ contains(inputs.test-results-reporters, 'annotations') }}
        exit-on-no-files: true
        exit-on-empty: true
      env:
        GITHUB_TOKEN: ${{ github.token }}
    # FIXME: Remove this ReportGenerator/.NET merge workaround after grcov ships
    # https://github.com/mozilla/grcov/pull/1568 and
    # https://github.com/mozilla/grcov/pull/1569, and merged coverage plus
    # publication outputs have been validated against the report contract.
    - uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
      if: ${{ !cancelled() && steps.collect.outputs.coverage != '' }}
      with:
        dotnet-version: "10.0.x"
    - name: Merge coverage with ReportGenerator
      id: coverage
      if: ${{ !cancelled() && steps.collect.outputs.coverage != '' }}
      uses: danielpalme/ReportGenerator-GitHub-Action@70c37c4d588cff5bf9cf190830c6f01dfcfb884b # 5.6.1
      with:
        reports: ${{ steps.collect.outputs.coverage }}
        targetdir: ${{ steps.directory.outputs.publication-path }}/coverage
        toolpath: ${{ runner.temp }}/reportgenerator-5.6.1
        reporttypes: Cobertura;JsonSummary
    - name: Prepare coverage upload matrix
      id: coverage-plan
      if: ${{ !cancelled() && steps.coverage.outcome == 'success' }}
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      env:
        ACTION_PATH: ${{ github.action_path }}
        REPORT_DIRECTORY: ${{ steps.directory.outputs.path }}
        PUBLICATION_DIRECTORY: ${{ steps.directory.outputs.publication-path }}
      with:
        script: |
          const { CoveragePublication } = await import(require('node:url').pathToFileURL(`${process.env.ACTION_PATH}/dist/index.js`));
          await new CoveragePublication({core, exec}).prepare({directory:process.env.REPORT_DIRECTORY,publicationDirectory:process.env.PUBLICATION_DIRECTORY,tool:`${process.env.RUNNER_TEMP}/reportgenerator-5.6.1/reportgenerator`});
    - name: Render consolidated summary and comment
      id: render
      if: ${{ !cancelled() && steps.collect.outcome == 'success' }}
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      env:
        ACTION_PATH: ${{ github.action_path }}
        REPORT_DIRECTORY: ${{ steps.directory.outputs.path }}
        PUBLICATION_DIRECTORY: ${{ steps.directory.outputs.publication-path }}
        TEST_SUMMARY: ${{ steps.tests.outputs.summary }}
        # The CTRF report output can exceed the process environment size limit.
        # Rendering only needs publication outcomes, not other step outputs.
        PUBLICATION_STEPS: |
          {
            "lint": {"outcome": "${{ steps.lint.outcome }}"},
            "code-scanning": {"outcome": "${{ steps.code-scanning.outcome }}"},
            "tests": {"outcome": "${{ steps.tests.outcome }}"},
            "coverage": {"outcome": "${{ steps.coverage.outcome }}"},
            "coverage-plan": {"outcome": "${{ steps.coverage-plan.outcome }}"}
          }
      with:
        script: |
          const { ReportPresentation } = await import(require('node:url').pathToFileURL(`${process.env.ACTION_PATH}/dist/index.js`));
          await new ReportPresentation({core, context}).render({directory:process.env.REPORT_DIRECTORY,publicationDirectory:process.env.PUBLICATION_DIRECTORY,template:`${process.env.ACTION_PATH}/report.md.hbs`,testSummary:process.env.TEST_SUMMARY,steps:JSON.parse(process.env.PUBLICATION_STEPS)});
    - id: upload
      if: ${{ !cancelled() && steps.collect.outcome == 'success' }}
      uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
      with:
        name: ci-publication-${{ github.run_attempt }}
        path: ${{ steps.directory.outputs.publication-path }}
        if-no-files-found: error
        retention-days: 7
    - name: Clean publication workspace
      if: ${{ always() && steps.directory.outputs.path != '' }}
      uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
      env:
        REPORT_DIRECTORY: ${{ steps.directory.outputs.path }}
      with:
        script: |
          await io.rmRF(process.env.REPORT_DIRECTORY);

Lingua principale
JavaScript
Stelle
5
Fork
1
Merge medio
5h 25m
PR unite (30g)
60

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di hoverkraft-tech/ci-github-common

Tutte le issue di hoverkraft-tech/ci-github-common

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.