Skip to content

Commit f8ac33c

Browse files
Fix CI artifact discovery
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 54830cd commit f8ac33c

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

testing/automation/run-cli-e2e.ps1

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
11
$ErrorActionPreference = 'Stop'
22
Set-StrictMode -Version Latest
33

4-
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot '..\..')
4+
$repoRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
55
$srcRoot = Join-Path $repoRoot 'src'
66
$configuration = if ($env:CONFIGURATION) { $env:CONFIGURATION } else { 'Release' }
77

8-
$daemonDll = Join-Path $srcRoot "UniGetUI.Avalonia\bin\$configuration\net10.0\UniGetUI.Avalonia.dll"
9-
$cliDll = Join-Path $srcRoot "UniGetUI.Cli\bin\$configuration\net10.0\UniGetUI.Cli.dll"
8+
function Resolve-BuildArtifact {
9+
param(
10+
[Parameter(Mandatory = $true)]
11+
[string] $ProjectName,
12+
[Parameter(Mandatory = $true)]
13+
[string] $AssemblyName
14+
)
15+
16+
$binRoot = Join-Path (Join-Path $srcRoot $ProjectName) 'bin'
17+
$separator = [System.IO.Path]::DirectorySeparatorChar
18+
$configurationSegment = [string]::Concat($separator, $configuration, $separator)
19+
$targetFrameworkSegment = [string]::Concat($separator, 'net10.0', $separator)
20+
21+
$candidate = Get-ChildItem -Path $binRoot -Recurse -Filter $AssemblyName -File -ErrorAction SilentlyContinue |
22+
Where-Object { $_.FullName.Contains($configurationSegment) -and $_.FullName.Contains($targetFrameworkSegment) } |
23+
Sort-Object LastWriteTimeUtc -Descending |
24+
Select-Object -First 1
25+
26+
if ($null -eq $candidate) {
27+
throw "Assembly $AssemblyName not found under $binRoot"
28+
}
29+
30+
return $candidate.FullName
31+
}
32+
33+
$daemonDll = Resolve-BuildArtifact -ProjectName 'UniGetUI.Avalonia' -AssemblyName 'UniGetUI.Avalonia.dll'
34+
$cliDll = Resolve-BuildArtifact -ProjectName 'UniGetUI.Cli' -AssemblyName 'UniGetUI.Cli.dll'
1035

1136
if (-not (Test-Path $daemonDll)) {
1237
throw "Daemon assembly not found at $daemonDll"
@@ -16,6 +41,9 @@ if (-not (Test-Path $cliDll)) {
1641
throw "CLI assembly not found at $cliDll"
1742
}
1843

44+
$daemonDll = (Resolve-Path $daemonDll).Path
45+
$cliDll = (Resolve-Path $cliDll).Path
46+
1947
$daemonRoot = Join-Path ([System.IO.Path]::GetTempPath()) ("unigetui-headless-" + [Guid]::NewGuid().ToString('N'))
2048
New-Item -ItemType Directory -Path $daemonRoot | Out-Null
2149

0 commit comments

Comments
 (0)