Skip to content

Commit b39b945

Browse files
#1178 build.yml: changed OpenSSL installation script for Windows - removed retry logic and improved error handling
1 parent 21a0f10 commit b39b945

1 file changed

Lines changed: 14 additions & 19 deletions

File tree

.github/workflows/build.yml

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,50 +78,45 @@ jobs:
7878
run: |
7979
$ErrorActionPreference = 'Stop'
8080
81+
Write-Host "Installing OpenSSL 3.6.1 via Chocolatey..."
8182
choco install openssl --version=3.6.1 -y --limit-output
8283
83-
# Refresh environment variables after installation
84-
refreshenv
85-
86-
# Locate OpenSSL (retry a few times to handle slow installs)
87-
$opensslPath = $null
84+
Write-Host "Locating OpenSSL installation..."
8885
$candidateRoots = @(
8986
"C:\Program Files\OpenSSL-Win64",
9087
"C:\Program Files\OpenSSL",
9188
"C:\OpenSSL-Win64",
9289
"C:\OpenSSL"
9390
)
9491
95-
for ($i = 0; $i -lt 3 -and -not $opensslPath; $i++) {
96-
$opensslPath = $candidateRoots | Where-Object { Test-Path $_ } | Select-Object -First 1
97-
98-
if (-not $opensslPath) {
99-
$probe = Get-ChildItem "C:\Program Files" -Filter "OpenSSL*" -Directory -ErrorAction SilentlyContinue | Select-Object -First 1
100-
if ($probe) { $opensslPath = $probe.FullName }
101-
}
92+
$opensslPath = $candidateRoots | Where-Object { Test-Path $_ } | Select-Object -First 1
10293
103-
if (-not $opensslPath -and $i -lt 2) { Start-Sleep -Seconds 2 }
94+
if (-not $opensslPath) {
95+
$probe = Get-ChildItem "C:\Program Files" -Filter "OpenSSL*" -Directory -ErrorAction SilentlyContinue | Select-Object -First 1
96+
if ($probe) { $opensslPath = $probe.FullName }
10497
}
10598
10699
if (-not $opensslPath) {
107-
Write-Error "OpenSSL not found after install. Checked: $($candidateRoots -join ', ') and Program Files probes."
100+
throw "OpenSSL not found after installation. Checked: $($candidateRoots -join ', ')"
108101
}
109102
103+
# Validate required components
110104
$includePath = Join-Path $opensslPath 'include'
111105
$binPath = Join-Path $opensslPath 'bin'
112106
$cryptoDll = Join-Path $binPath 'libcrypto-3-x64.dll'
113-
$sslDll = Join-Path $binPath 'libssl-3-x64.dll'
107+
$sslDll = Join-Path $binPath 'libssl-3-x64.dll'
114108
115109
if (-not (Test-Path $includePath)) {
116-
Write-Error "OpenSSL include directory not found at $includePath"
110+
throw "OpenSSL include directory not found at: $includePath"
117111
}
118112
119113
if (-not (Test-Path $cryptoDll) -or -not (Test-Path $sslDll)) {
120-
Write-Error "OpenSSL DLLs not found at $binPath (expected libcrypto-3-x64.dll and libssl-3-x64.dll)"
114+
throw "OpenSSL DLLs not found at: $binPath"
121115
}
122116
123-
"OPENSSL_ROOT_DIR=$opensslPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
124-
"Found OpenSSL at: $opensslPath"
117+
# Export to GitHub environment
118+
Add-Content -Path $env:GITHUB_ENV -Value "OPENSSL_ROOT_DIR=$opensslPath"
119+
Write-Host "OpenSSL configured at: $opensslPath"
125120
126121
- name: Download Boost [windows]
127122
if: startsWith(matrix.os, 'windows')

0 commit comments

Comments
 (0)