Skip to content

Commit 681d32f

Browse files
EvangelinkCopilotCopilot
authored
Reorganize GitHub Actions report as a test-report extension (dotnet#54722)
* Reorganize GitHub Actions report as a test-report extension Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 63973d5 commit 681d32f

3 files changed

Lines changed: 31 additions & 8 deletions

File tree

docs/core/testing/microsoft-testing-platform-features.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Use the following path based on your goal:
3131

3232
- Need to customize terminal output: [Terminal output](./microsoft-testing-platform-terminal-output.md) (built-in)
3333
- Need TRX or Azure DevOps reports: [Test reports](./microsoft-testing-platform-test-reports.md) (extension)
34-
- Need GitHub Actions-native output (log groups, annotations, and job summary): [GitHub Actions report](https://www.nuget.org/packages/Microsoft.Testing.Extensions.GitHubActionsReport) (extension, experimental)
34+
- Need GitHub Actions-native output (log groups, annotations, and job summary): [GitHub Actions report](./microsoft-testing-platform-test-reports.md#github-actions-reports) (extension, experimental)
3535
- Need coverage data: [Code coverage](./microsoft-testing-platform-code-coverage.md) (extension)
3636
- Need crash or hang diagnostics: [Crash and hang dumps](./microsoft-testing-platform-crash-hang-dumps.md) (extension)
3737
- Need to retry failed tests: [Retry](./microsoft-testing-platform-retry.md#retry) (extension)
@@ -54,11 +54,7 @@ These features require installing NuGet packages.
5454

5555
**[Test reports](./microsoft-testing-platform-test-reports.md)**
5656

57-
Generate test report files (TRX, Azure DevOps).
58-
59-
**[GitHub Actions report](https://www.nuget.org/packages/Microsoft.Testing.Extensions.GitHubActionsReport)** (experimental, introduced in MTP 2.3.0)
60-
61-
Emit GitHub Actions-native workflow commands so test runs produce a first-class experience: per-assembly log groups, failure annotations (surfaced in the workflow **Annotations** tab and, when the source location resolves, on the pull request's **Files changed** diff), a Markdown job summary appended to `GITHUB_STEP_SUMMARY`, and slow-test notices. The extension activates automatically when the `GITHUB_ACTIONS` environment variable is `true`, or elsewhere with the `--report-gh` switch. Each feature can be turned on or off individually with the `--report-gh-groups`, `--report-gh-annotations`, `--report-gh-step-summary`, and `--report-gh-slow-test-notices` options, and the slow-test threshold is set with `--report-gh-slow-test-threshold`. Register it manually with `builder.AddGitHubActionsProvider()`.
57+
Generate test report files (TRX, HTML, JUnit, CTRF, Azure DevOps, GitHub Actions).
6258

6359
**[Code coverage](./microsoft-testing-platform-code-coverage.md)**
6460

docs/core/testing/microsoft-testing-platform-test-reports.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Microsoft.Testing.Platform (MTP) test reports
3-
description: Learn about the MTP extensions that create test report files (TRX, HTML, JUnit, CTRF, Azure DevOps).
3+
description: Learn about the MTP extensions that create test report files (TRX, HTML, JUnit, CTRF, Azure DevOps, GitHub Actions).
44
author: evangelink
55
ms.author: amauryleve
66
ms.date: 06/16/2026
@@ -163,3 +163,30 @@ builder.TestHost.AddAzureDevOpsProvider();
163163
> The **MTP version** column lists the MTP release in which each option first became available in a stable build. The Azure DevOps extension itself became stable in MTP 1.9.0 with `--report-azdo` and `--report-azdo-severity`; the remaining options were added in MTP 2.3.0.
164164
165165
The extension automatically detects that it is running in continuous integration (CI) environment by checking the `TF_BUILD` environment variable.
166+
167+
## GitHub Actions reports
168+
169+
The GitHub Actions report emits GitHub Actions-native workflow commands so test runs produce a first-class experience on the runner: per-assembly log groups, failed and skipped test annotations (surfaced in the workflow **Annotations** tab and, when the source location resolves, on the pull request's **Files changed** diff), a Markdown job summary appended to the file referenced by `GITHUB_STEP_SUMMARY`, and slow-test notices.
170+
171+
The extension activates only when the run is on GitHub Actions (the `GITHUB_ACTIONS` environment variable is `true`) and the `--report-gh` switch is set; otherwise it does nothing. When active, each feature is enabled by default and can be turned off individually with its `--report-gh-*` option.
172+
173+
> [!NOTE]
174+
> Available in MTP starting with version 2.3.0. This extension is experimental, and its options and output format might change in a future version.
175+
176+
### Manual registration
177+
178+
```csharp
179+
var builder = await TestApplication.CreateBuilderAsync(args);
180+
builder.AddGitHubActionsProvider();
181+
```
182+
183+
### Options
184+
185+
| Option | MTP version | Description |
186+
|---|---|---|
187+
| `--report-gh` | 2.3.0 | Enables the GitHub Actions report generator so test runs emit workflow commands. Requires the run to be on GitHub Actions. |
188+
| `--report-gh-groups` | 2.3.0 | Enables or disables per-assembly log groups. Valid values are `on` (default) and `off`. Requires `--report-gh`. |
189+
| `--report-gh-annotations` | 2.3.0 | Enables or disables annotations for failed and skipped tests. Valid values are `on` (default) and `off`. Requires `--report-gh`. |
190+
| `--report-gh-step-summary` | 2.3.0 | Enables or disables writing a Markdown job summary to the file referenced by `GITHUB_STEP_SUMMARY`. Valid values are `on` (default) and `off`. Requires `--report-gh`. |
191+
| `--report-gh-slow-test-notices` | 2.3.0 | Enables or disables slow-test notices. Valid values are `on` (default) and `off`. Requires `--report-gh`. |
192+
| `--report-gh-slow-test-threshold` | 2.3.0 | The duration a test can run before a slow-test notice is emitted. Accepts a bare number of seconds or a value with a unit suffix such as `90s`, `2m`, or `1.5h`. The default is `60s`. Requires `--report-gh`. |

docs/navigate/devops-testing/toc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ items:
307307
displayName: MTP,terminal,test reporter,ANSI,progress
308308
- name: Test reports
309309
href: ../../core/testing/microsoft-testing-platform-test-reports.md
310-
displayName: MTP,TRX,test report,Azure DevOps
310+
displayName: MTP,TRX,test report,Azure DevOps,GitHub Actions
311311
- name: Code coverage
312312
href: ../../core/testing/microsoft-testing-platform-code-coverage.md
313313
displayName: MTP,code coverage,coverage

0 commit comments

Comments
 (0)