From fadd4eb10683551901b3b04899c3dd74b2b7ec1f Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Tue, 31 Dec 2024 16:16:17 -0700 Subject: [PATCH 1/3] Fix test logs collection They are intended to be collected as part of the `testResults` artifact. --- .github/actions/publish-artifacts/action.yaml | 7 ------- tools/artifacts/testResults.ps1 | 3 ++- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/actions/publish-artifacts/action.yaml b/.github/actions/publish-artifacts/action.yaml index 228b640..2a75c4d 100644 --- a/.github/actions/publish-artifacts/action.yaml +++ b/.github/actions/publish-artifacts/action.yaml @@ -32,13 +32,6 @@ runs: name: build_logs-${{ runner.os }} path: ${{ runner.temp }}/_artifacts/build_logs continue-on-error: true - - name: 📢 Upload test_logs - if: always() - uses: actions/upload-artifact@v4 - with: - name: test_logs-${{ runner.os }} - path: ${{ runner.temp }}/_artifacts/test_logs - continue-on-error: true - name: 📢 Upload testResults if: always() uses: actions/upload-artifact@v4 diff --git a/tools/artifacts/testResults.ps1 b/tools/artifacts/testResults.ps1 index 301a437..0714695 100644 --- a/tools/artifacts/testResults.ps1 +++ b/tools/artifacts/testResults.ps1 @@ -7,7 +7,8 @@ $result = @{} $testRoot = Resolve-Path "$PSScriptRoot\..\..\test" $result[$testRoot] = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory | Get-ChildItem -Recurse -File) -$testlogsPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY\test_logs" +$artifactStaging = & "$PSScriptRoot\..\Get-ArtifactsStagingDirectory.ps1" +$testlogsPath = Join-Path $artifactStaging "test_logs" if (Test-Path $testlogsPath) { $result[$testlogsPath] = Get-ChildItem "$testlogsPath\*"; } From 16f72e358da97fb5058f32eef4002a1dc33a6e3d Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Wed, 1 Jan 2025 10:30:13 -0700 Subject: [PATCH 2/3] Take care to use proper slashes per OS for testing --- tools/Get-ArtifactsStagingDirectory.ps1 | 2 +- tools/artifacts/testResults.ps1 | 2 +- tools/dotnet-test-cloud.ps1 | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/Get-ArtifactsStagingDirectory.ps1 b/tools/Get-ArtifactsStagingDirectory.ps1 index 391e571..18967f4 100644 --- a/tools/Get-ArtifactsStagingDirectory.ps1 +++ b/tools/Get-ArtifactsStagingDirectory.ps1 @@ -4,7 +4,7 @@ Param( if ($env:BUILD_ARTIFACTSTAGINGDIRECTORY) { $ArtifactStagingFolder = $env:BUILD_ARTIFACTSTAGINGDIRECTORY } elseif ($env:RUNNER_TEMP) { - $ArtifactStagingFolder = "$env:RUNNER_TEMP\_artifacts" + $ArtifactStagingFolder = Join-Path $env:RUNNER_TEMP _artifacts } else { $ArtifactStagingFolder = [System.IO.Path]::GetFullPath("$PSScriptRoot/../obj/_artifacts") if ($CleanIfLocal -and (Test-Path $ArtifactStagingFolder)) { diff --git a/tools/artifacts/testResults.ps1 b/tools/artifacts/testResults.ps1 index 0714695..519a63c 100644 --- a/tools/artifacts/testResults.ps1 +++ b/tools/artifacts/testResults.ps1 @@ -10,7 +10,7 @@ $result[$testRoot] = (Get-ChildItem "$testRoot\TestResults" -Recurse -Directory $artifactStaging = & "$PSScriptRoot\..\Get-ArtifactsStagingDirectory.ps1" $testlogsPath = Join-Path $artifactStaging "test_logs" if (Test-Path $testlogsPath) { - $result[$testlogsPath] = Get-ChildItem "$testlogsPath\*"; + $result[$testlogsPath] = Get-ChildItem $testlogsPath -Recurse; } $result diff --git a/tools/dotnet-test-cloud.ps1 b/tools/dotnet-test-cloud.ps1 index 33ff3d7..10cd431 100644 --- a/tools/dotnet-test-cloud.ps1 +++ b/tools/dotnet-test-cloud.ps1 @@ -44,6 +44,9 @@ if ($x86) { } } +$testBinLog = Join-Path $ArtifactStagingFolder (Join-Path build_logs test.binlog) +$testDiagLog = Join-Path $ArtifactStagingFolder (Join-Path test_logs diag.log) + & $dotnet test $RepoRoot ` --no-build ` -c $Configuration ` @@ -52,8 +55,8 @@ if ($x86) { --settings "$PSScriptRoot/test.runsettings" ` --blame-hang-timeout 60s ` --blame-crash ` - -bl:"$ArtifactStagingFolder/build_logs/test.binlog" ` - --diag "$ArtifactStagingFolder/test_logs/diag.log;TraceLevel=info" ` + -bl:"$testBinLog" ` + --diag "$testDiagLog;TraceLevel=info" ` --logger trx ` $unknownCounter = 0 From 656c5ff5cb3897ca2151842a1e050598c422b140 Mon Sep 17 00:00:00 2001 From: Andrew Arnott Date: Sun, 5 Jan 2025 13:15:50 -0700 Subject: [PATCH 3/3] Match test assemblies that are built as exe's Fixes #332 --- tools/dotnet-test-cloud.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/dotnet-test-cloud.ps1 b/tools/dotnet-test-cloud.ps1 index 10cd431..02891d9 100644 --- a/tools/dotnet-test-cloud.ps1 +++ b/tools/dotnet-test-cloud.ps1 @@ -68,7 +68,7 @@ Get-ChildItem -Recurse -Path $RepoRoot\test\*.trx |% { $runTitle = $null if ($x.TestRun.TestDefinitions -and $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')) { $storage = $x.TestRun.TestDefinitions.GetElementsByTagName('UnitTest')[0].storage -replace '\\','/' - if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.dll$') { + if ($storage -match '/(?net[^/]+)/(?:(?[^/]+)/)?(?[^/]+)\.(dll|exe)$') { if ($matches.rid) { $runTitle = "$($matches.lib) ($($matches.tfm), $($matches.rid), $Agent)" } else {