From 5e1717fa6eaa66e6f4899c51f375f9568c0ade3a Mon Sep 17 00:00:00 2001 From: Ian Jennings Date: Tue, 1 Oct 2024 19:55:21 -0500 Subject: [PATCH] make sure we unzip first --- .github/workflows/testdriver.yml | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/testdriver.yml b/.github/workflows/testdriver.yml index 55a53000e..85572f0d9 100644 --- a/.github/workflows/testdriver.yml +++ b/.github/workflows/testdriver.yml @@ -123,32 +123,46 @@ jobs: exit 1 } - # Download the artifact + # Download the artifact (zipped file) Write-Host "Starting artifact download..." + $artifactZipPath = "$env:TEMP\artifact.zip" try { Invoke-WebRequest -Uri $artifactUrl ` -Headers $headers ` - -OutFile $artifactFilePath ` + -OutFile $artifactZipPath ` -MaximumRedirection 5 - Write-Host "Artifact downloaded successfully to $artifactFilePath" + Write-Host "Artifact downloaded successfully to $artifactZipPath" } catch { Write-Error "Error downloading artifact: $_" exit 1 } - # Check if the artifact exists and is executable - if (Test-Path -Path $artifactFilePath) { - Write-Host "Executable file found: $artifactFilePath" + # Unzip the artifact + $artifactUnzipPath = "$env:TEMP\artifact" + Write-Host "Unzipping the artifact to $artifactUnzipPath..." + try { + Expand-Archive -Path $artifactZipPath -DestinationPath $artifactUnzipPath -Force + Write-Host "Artifact unzipped successfully to $artifactUnzipPath" + } catch { + Write-Error "Failed to unzip the artifact: $_" + exit 1 + } + + # Find the executable within the unzipped files (modify if specific path is known) + $artifactFilePath = Get-ChildItem -Path $artifactUnzipPath -Filter *.exe -Recurse | Select-Object -First 1 + + if ($artifactFilePath) { + Write-Host "Executable file found: $($artifactFilePath.FullName)" } else { - Write-Error "Downloaded file not found. Exiting." + Write-Error "Executable file not found. Exiting." exit 1 } # Run the executable and log the result - Write-Host "Running the executable: $artifactFilePath..." + Write-Host "Running the executable: $($artifactFilePath.FullName)..." try { - Start-Process -FilePath $artifactFilePath -Wait + Start-Process -FilePath $artifactFilePath.FullName -Wait Write-Host "Executable ran successfully." } catch { Write-Error "Failed to run the executable: $_"