Skip to content

Commit

Permalink
Enable TRX reports in build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKotsenas committed May 30, 2024
1 parent 18a1803 commit 1edaf28
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ jobs:
- name: Test
run: dotnet test --no-build --configuration Release

# TODO: Create a TRX report and upload as an artifact. Tracked by #22.
# - name: Publish Test Report
# uses: dorny/test-reporter@v1
# if: success() || failure()
# with:
# name: .NET Test Report (${{ matrix.os }})
# path: "artifacts/TestResults/**/*.trx"
# reporter: dotnet-trx
# fail-on-error: true
# fail-on-empty: true
- name: Publish Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: .NET Test Report (${{ matrix.os }})
path: "artifacts/TestResults/**/*.trx"
reporter: dotnet-trx
fail-on-error: true
fail-on-empty: true

- name: Upload binlogs
uses: actions/upload-artifact@v4
Expand Down
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
</PropertyGroup>

<Import Project="build/targets/artifacts/Artifacts.props" />
<Import Project="build/targets/tests/Tests.props" />
</Project>
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<Project>
<Import Project="build/targets/artifacts/Artifacts.targets" />
<Import Project="build/targets/tests/Tests.targets" />
</Project>
1 change: 1 addition & 0 deletions build/targets/artifacts/Artifacts.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<Project>
<PropertyGroup>
<ArtifactsPath>$(RepoRoot)/artifacts</ArtifactsPath>
<ArtifactsTestResultsPath>$(ArtifactsPath)/TestResults</ArtifactsTestResultsPath>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions build/targets/tests/Tests.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</Project>
7 changes: 7 additions & 0 deletions build/targets/tests/Tests.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup Condition=" '$(IsTestProject)' == 'true' ">
<!-- Enable test logging to TRX files and place them in the artifacts directory -->
<VSTestLogger>trx%3bLogFileName=$(MSBuildProjectName).trx</VSTestLogger>
<VSTestResultsDirectory Condition="'$(VSTestResultsDirectory)' == ''">$(ArtifactsTestResultsPath)/$(TargetFramework)</VSTestResultsDirectory>
</PropertyGroup>
</Project>

0 comments on commit 1edaf28

Please sign in to comment.