You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2021-09-08-github-code-coverage.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,9 @@ This is a follow-up to my previous post: [The Easiest Way to Generate and Publis
19
19
20
20
I was familiar with adding Code Coverage to my pipelines in Azure DevOps and having a Code Coverage tab appear on the pipeline summary page, but I wasn't sure what was available for GitHub Actions. With GitHub Actions really starting to pick up steam, especially with recent additions such as [Composite Actions](https://www.colinsalmcorner.com/github-composite-actions/), I thought now would be a great time to explore.
21
21
22
+
> Since this post was originally published, GitHub has added [Job Summaries](https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/) which can be used to display the code coverage report summary right next to the workflow run logs! I've [updated this post with an additional section](#adding-code-coverage-to-job-summary) to include that functionality.
23
+
{: .prompt-tip }
24
+
22
25
## Adding Code Coverage to Pull Request
23
26
24
27
I found this GitHub Action in the marketplace - [Code Coverage Summary](https://github.com/marketplace/actions/code-coverage-summary). There might be others, but this one seemed simple and had the functionality I was looking for.
@@ -108,7 +111,7 @@ The nice thing with this action is that if a new commit is pushed to the PR trig
108
111
109
112
## Adding Code Coverage to Job Summary
110
113
111
-
I think this is looking great, but what if we don't happen to create a pull request, how can we neatly see our code coverage report? Well, since May 9, 2022 (and GitHub Enterprise Server >= 3.6.0) we can use the [Job Summary](https://github.blog/changelog/2022-05-09-github-actions-enhance-your-actions-with-job-summaries/)!
114
+
I think this is looking great, but what if we don't happen to create a pull request, how can we neatly see our code coverage report? Well, since May 9, 2022 (and GitHub Enterprise Server >= 3.6.0) we can use the [Job Summary](https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/)!
112
115
113
116
Since the CodeCoverageSummary action is already generating the markdown for us, all we have to do is append it to the [`$GITHUB_STEP_SUMMARY`](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary) environment variable. Add in the following run command to the end of the job:
114
117
@@ -145,6 +148,6 @@ _Code Coverage Summary Report generated by `reportgenerator` added to the job su
145
148
146
149
## Conclusion
147
150
148
-
Maybe not _as pretty_ as the Cobertura report shown in Azure DevOps, but just as effective! Certainly the addition of [job summaries](https://github.blog/changelog/2022-05-09-github-actions-enhance-your-actions-with-job-summaries/) makes this a better experience.
151
+
Maybe not _as pretty_ as the Cobertura report shown in Azure DevOps, but just as effective! Certainly the addition of [job summaries](https://github.blog/news-insights/product-news/supercharging-github-actions-with-job-summaries/) makes this a better experience.
149
152
150
153
And hey, now on the GitHub Pull Request, you get to actually see the code coverage report before the *[end of the entire pipeline run](/posts/azure-devops-code-coverage/#code-coverage-tab-not-showing-up)* like in Azure DevOps 😀.
0 commit comments