Skip to content

Commit a48090f

Browse files
committed
fix: powershell for windows binary extraction
1 parent 96e3af5 commit a48090f

File tree

1 file changed

+42
-16
lines changed

1 file changed

+42
-16
lines changed

.github/workflows/test-binaries.yml

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,25 @@ jobs:
213213
tar -xzf binary.tar.gz
214214
Set-Location ..
215215
216-
# List what we have
217-
Get-ChildItem -Recurse | Where-Object {$_.Name -like "*llama*"} | Select-Object -First 10
216+
# List what we have (showing directory structure)
217+
Write-Host "Directory structure after extraction:"
218+
Get-ChildItem -Recurse | Where-Object {$_.Name -like "*llama*" -or $_.Name -like "*.exe"} | Select-Object -First 10
218219
219-
# Find the binary
220-
$binaryPath = Get-ChildItem -Recurse -Name "${{ matrix.binary-name }}" | Select-Object -First 1
221-
if ($binaryPath) {
222-
Write-Host "Found binary at: $binaryPath"
223-
} else {
224-
Write-Host "Binary not found, listing all .exe files:"
225-
Get-ChildItem -Recurse -Filter "*.exe" | Select-Object -First 5
220+
# Find the binary with better error handling
221+
$binaryPath = $null
222+
try {
223+
$binaryPath = Get-ChildItem -Recurse -Filter "${{ matrix.binary-name }}" | Select-Object -First 1 -ExpandProperty Name
224+
if ($binaryPath) {
225+
$fullBinaryPath = Get-ChildItem -Recurse -Filter "${{ matrix.binary-name }}" | Select-Object -First 1 -ExpandProperty FullName
226+
Write-Host "Found binary at: $fullBinaryPath"
227+
}
228+
} catch {
229+
Write-Host "Error searching for binary: $($_.Exception.Message)"
230+
}
231+
232+
if (-not $binaryPath) {
233+
Write-Host "Binary ${{ matrix.binary-name }} not found, listing all .exe files:"
234+
Get-ChildItem -Recurse -Filter "*.exe" | ForEach-Object { Write-Host $_.FullName }
226235
}
227236
228237
- name: Make binary executable (Linux/macOS)
@@ -247,17 +256,34 @@ jobs:
247256
if: runner.os == 'Windows'
248257
shell: pwsh
249258
run: |
250-
# Find the actual binary
251-
$binaryPath = Get-ChildItem -Recurse -Name "${{ matrix.binary-name }}" | Select-Object -First 1
252-
if ($binaryPath) {
259+
# Find the actual binary using -Filter instead of -Name
260+
$binaryFile = Get-ChildItem -Recurse -Filter "${{ matrix.binary-name }}" | Select-Object -First 1
261+
262+
if ($binaryFile) {
263+
Write-Host "Found binary at: $($binaryFile.FullName)"
264+
253265
# Create standardized directory structure
254266
New-Item -ItemType Directory -Force -Path "llama\build\bin"
255-
Copy-Item $binaryPath "llama\build\bin\${{ matrix.binary-name }}"
267+
Copy-Item $binaryFile.FullName "llama\build\bin\${{ matrix.binary-name }}"
256268
Write-Host "Binary copied to: llama\build\bin\${{ matrix.binary-name }}"
269+
270+
# Verify the copy worked
271+
if (Test-Path "llama\build\bin\${{ matrix.binary-name }}") {
272+
Write-Host "Binary successfully copied and ready for testing"
273+
} else {
274+
Write-Host "Error: Binary copy failed"
275+
exit 1
276+
}
257277
} else {
258-
Write-Host "Binary not found!"
259-
Write-Host "Available files:"
260-
Get-ChildItem -Recurse -Filter "*server*" | Select-Object -First 10
278+
Write-Host "Binary ${{ matrix.binary-name }} not found!"
279+
Write-Host "Searching for any server executables:"
280+
Get-ChildItem -Recurse -Filter "*server*.exe" | ForEach-Object {
281+
Write-Host "Found: $($_.FullName)"
282+
}
283+
Write-Host "All .exe files:"
284+
Get-ChildItem -Recurse -Filter "*.exe" | ForEach-Object {
285+
Write-Host "Found: $($_.FullName)"
286+
}
261287
exit 1
262288
}
263289

0 commit comments

Comments
 (0)