Skip to content

Commit

Permalink
Use .NET 8 SDK's artifacts output and enable test reports in CI (#23)
Browse files Browse the repository at this point in the history
* Use .NET 8 SDK's artifacts output

* Enable TRX reports in build pipeline

* Switch from test reporter to basic artifact
  • Loading branch information
MattKotsenas authored May 30, 2024
1 parent eaf5d47 commit d8635ba
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 10 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ 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: actions/upload-artifact@v4
if: success() || failure()
with:
name: .NET Test Reports (${{ matrix.os }})
path: "artifacts/TestResults/**/*.trx"
if-no-files-found: error

- name: Upload binlogs
uses: actions/upload-artifact@v4
Expand Down
8 changes: 8 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
</PropertyGroup>

<Import Project="build/targets/artifacts/Artifacts.props" />
<Import Project="build/targets/tests/Tests.props" />
</Project>
4 changes: 4 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Project>
<Import Project="build/targets/artifacts/Artifacts.targets" />
<Import Project="build/targets/tests/Tests.targets" />
</Project>
6 changes: 6 additions & 0 deletions build/targets/artifacts/Artifacts.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<PropertyGroup>
<ArtifactsPath>$(RepoRoot)/artifacts</ArtifactsPath>
<ArtifactsTestResultsPath>$(ArtifactsPath)/TestResults</ArtifactsTestResultsPath>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions build/targets/artifacts/Artifacts.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<Project>
</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 d8635ba

Please sign in to comment.