6161 # Install XML tools
6262 echo Installing XML tools ...
6363 sudo apt update
64- sudo apt install libxml2-utils xmlstarlet
64+ sudo apt install libxml2-utils # aka xmllint read-command. xmlstarlet is not required
6565
6666 # Extract actual coverage % from the Coverlet XML-file
6767 - name : Coverage by unit tests
@@ -76,36 +76,48 @@ jobs:
7676 echo "BranchCoverage=$branch_coverage" >> $GITHUB_OUTPUT
7777 echo "BRANCH_COVERAGE=$branch_coverage" >> $GITHUB_ENV
7878
79- # The action below replaces the following command: dotnet tool run reportgenerator -reports:$coverage_file -targetdir:coveragereport
79+ # The action below replaces the following command: dotnet tool run reportgenerator -reports:$coverage_file -targetdir:coveragereport-md
8080 # Docs: https://reportgenerator.io/
81- - name : Generate coverage report (HTML)
82- if : steps.files.outputs.COVERAGE_FILE_EXISTS == 'true'
83- uses : danielpalme/ReportGenerator-GitHub-Action@5.4.7 # Docs: https://github.com/marketplace/actions/reportgenerator
84- with :
85- reports : ${{ steps.files.outputs.COVERAGE_FILE }}
86- targetdir : coveragereport
87- reporttypes : Html
8881 - name : Generate coverage report (Markdown)
8982 if : steps.files.outputs.COVERAGE_FILE_EXISTS == 'true'
9083 uses : danielpalme/ReportGenerator-GitHub-Action@5.4.7 # Docs: https://github.com/marketplace/actions/reportgenerator
9184 with :
9285 reports : ${{ steps.files.outputs.COVERAGE_FILE }}
9386 targetdir : coveragereport-md
9487 reporttypes : MarkdownSummaryGithub
88+
89+ # DOCS Storing and sharing data from a workflow -> https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow
9590 - name : Upload coverage MD-report artifact
96- uses : actions/upload-artifact@v4
91+ uses : actions/upload-artifact@v4 # https://github.com/actions/upload-artifact
9792 with :
98- name : CoverageReport # Artifact name
93+ name : CoverageReport-markdown # Artifact name
9994 path : coveragereport-md # Directory containing files to upload
10095 - name : Publish coverage in build summary # Only applicable if 'MarkdownSummaryGithub' or one of the other Markdown report types is generated
101- run : cat coveragereport-md/SummaryGithub.md >> $GITHUB_STEP_SUMMARY # Adjust path and filename if necessary
96+ run : |
97+ echo Listing files of MD report...
98+ find coveragereport-md -type f -print | sort
99+ echo Publishing coverage in build summary...
100+ cat coveragereport-md/SummaryGithub.md >> $GITHUB_STEP_SUMMARY # Adjust path and filename if necessary
102101 shell : bash
103- - name : List report files
102+
103+ # The action below replaces the following command: dotnet tool run reportgenerator -reports:$coverage_file -targetdir:coveragereport
104+ # Docs: https://reportgenerator.io/
105+ - name : Generate coverage report (HTML)
106+ if : steps.files.outputs.COVERAGE_FILE_EXISTS == 'true'
107+ uses : danielpalme/ReportGenerator-GitHub-Action@5.4.7 # Docs: https://github.com/marketplace/actions/reportgenerator
108+ with :
109+ reports : ${{ steps.files.outputs.COVERAGE_FILE }}
110+ targetdir : coveragereport
111+ reporttypes : HtmlInline # Html is applicable for websites only
112+ - name : Archive code coverage report
113+ uses : actions/upload-artifact@v4
114+ with :
115+ name : CoverageReport-HTML
116+ path : coveragereport/index.html
117+ - name : List HTML report files
104118 run : |
105- echo List files of HTML report...
119+ echo Listing files of HTML report...
106120 find coveragereport -type f -print | sort
107- echo List files of MD report...
108- find coveragereport-md -type f -print | sort
109121
110122 # build2:
111123 # runs-on: ubuntu-latest
0 commit comments