From d8635ba66bf25beb223815b392a916ba564de1a2 Mon Sep 17 00:00:00 2001 From: Matt Kotsenas Date: Thu, 30 May 2024 15:59:10 -0700 Subject: [PATCH] Use .NET 8 SDK's artifacts output and enable test reports in CI (#23) * Use .NET 8 SDK's artifacts output * Enable TRX reports in build pipeline * Switch from test reporter to basic artifact --- .github/workflows/main.yml | 17 +++++++---------- Directory.Build.props | 8 ++++++++ Directory.Build.targets | 4 ++++ build/targets/artifacts/Artifacts.props | 6 ++++++ build/targets/artifacts/Artifacts.targets | 2 ++ build/targets/tests/Tests.props | 2 ++ build/targets/tests/Tests.targets | 7 +++++++ 7 files changed, 36 insertions(+), 10 deletions(-) create mode 100644 Directory.Build.props create mode 100644 Directory.Build.targets create mode 100644 build/targets/artifacts/Artifacts.props create mode 100644 build/targets/artifacts/Artifacts.targets create mode 100644 build/targets/tests/Tests.props create mode 100644 build/targets/tests/Tests.targets diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b9dd523d..c952c8a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000..75594389 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,8 @@ + + + $(MSBuildThisFileDirectory) + + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets new file mode 100644 index 00000000..9bd765d4 --- /dev/null +++ b/Directory.Build.targets @@ -0,0 +1,4 @@ + + + + diff --git a/build/targets/artifacts/Artifacts.props b/build/targets/artifacts/Artifacts.props new file mode 100644 index 00000000..f7bda062 --- /dev/null +++ b/build/targets/artifacts/Artifacts.props @@ -0,0 +1,6 @@ + + + $(RepoRoot)/artifacts + $(ArtifactsPath)/TestResults + + diff --git a/build/targets/artifacts/Artifacts.targets b/build/targets/artifacts/Artifacts.targets new file mode 100644 index 00000000..8c119d54 --- /dev/null +++ b/build/targets/artifacts/Artifacts.targets @@ -0,0 +1,2 @@ + + diff --git a/build/targets/tests/Tests.props b/build/targets/tests/Tests.props new file mode 100644 index 00000000..8c119d54 --- /dev/null +++ b/build/targets/tests/Tests.props @@ -0,0 +1,2 @@ + + diff --git a/build/targets/tests/Tests.targets b/build/targets/tests/Tests.targets new file mode 100644 index 00000000..b3078335 --- /dev/null +++ b/build/targets/tests/Tests.targets @@ -0,0 +1,7 @@ + + + + trx%3bLogFileName=$(MSBuildProjectName).trx + $(ArtifactsTestResultsPath)/$(TargetFramework) + +