Skip to content

Commit 290c1c2

Browse files
committed
fix: openssl install
1 parent 43a476b commit 290c1c2

1 file changed

Lines changed: 62 additions & 64 deletions

File tree

.github/workflows/windows-msvc.yml

Lines changed: 62 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -56,73 +56,71 @@ jobs:
5656
path: ${{ matrix.openssl_root }}
5757
key: Windows-OpenSSL-${{ matrix.openssl_arch }}-3.2.6
5858

59-
# Install OpenSSL 3.2.6 for both x86 and x64 architectures
59+
# Install OpenSSL 3.2.6 for both x86 and x64 architectures choco install openssl -y
6060
- name: Install OpenSSL ${{ matrix.openssl_arch }}
6161
if: steps.cache-openssl.outputs.cache-hit != 'true'
62+
shell: pwsh
6263
run: |
63-
choco install openssl --version 3.2.6 --allow-downgrade -y
64-
# shell: pwsh
65-
# run: |
66-
# $arch = "${{ matrix.openssl_arch }}"
67-
# $version = "3_2_6"
68-
# $opensslUrl = if ($arch -eq "x64") {
69-
# "https://slproweb.com/download/Win64OpenSSL-${version}.msi"
70-
# } else {
71-
# "https://slproweb.com/download/Win32OpenSSL-${version}.msi"
72-
# }
73-
# $installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
74-
# $installDir = "${{ matrix.openssl_root }}"
75-
76-
# Write-Host "Downloading OpenSSL ${version} for ${arch}..."
77-
# Write-Host "URL: $opensslUrl"
78-
# Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath -UseBasicParsing
79-
80-
# Write-Host "Downloaded file size: $(Get-Item $installerPath).Length bytes"
81-
82-
# Write-Host "Installing OpenSSL ${version} for ${arch}..."
83-
# Write-Host "Target directory: $installDir"
84-
85-
# # Create target directory if it doesn't exist
86-
# if (-not (Test-Path $installDir)) {
87-
# New-Item -ItemType Directory -Path $installDir -Force | Out-Null
88-
# Write-Host "Created directory: $installDir"
89-
# }
90-
91-
# $installArgs = @(
92-
# "/i",
93-
# "`"$installerPath`"",
94-
# "/quiet",
95-
# "INSTALLDIR=`"$installDir`"",
96-
# "/norestart",
97-
# "/L*v", # Enable verbose logging
98-
# "`"$env:TEMP\openssl_install.log`""
99-
# )
100-
101-
# Write-Host "Running: msiexec $($installArgs -join ' ')"
102-
# $process = Start-Process msiexec -ArgumentList $installArgs -Wait -PassThru
103-
104-
# Write-Host "MSI install exit code: $($process.ExitCode)"
105-
106-
# # Wait for installation to complete
107-
# Start-Sleep -Seconds 5
108-
109-
# # Check if installation succeeded
110-
# $opensslExe = "$installDir\bin\openssl.exe"
111-
# Write-Host "Checking for OpenSSL at: $opensslExe"
112-
113-
# if (Test-Path $opensslExe) {
114-
# Write-Host "✓ OpenSSL installed successfully"
115-
# & $opensslExe version
116-
# } else {
117-
# Write-Host "✗ OpenSSL not found at expected location"
118-
# Write-Host "Listing install directory contents:"
119-
# Get-ChildItem -Path $installDir -Recurse -ErrorAction SilentlyContinue | Select-Object -First 20 FullName
120-
# Write-Host "Install log (last 50 lines):"
121-
# Get-Content "$env:TEMP\openssl_install.log" -Tail 50 -ErrorAction SilentlyContinue
122-
# exit 1
123-
# }
124-
125-
# Write-Host "OpenSSL ${version} (${arch}) installation completed"
64+
$arch = "${{ matrix.openssl_arch }}"
65+
$version = "3_2_6"
66+
$opensslUrl = if ($arch -eq "x64") {
67+
"https://slproweb.com/download/Win64OpenSSL-${version}.msi"
68+
} else {
69+
"https://slproweb.com/download/Win32OpenSSL-${version}.msi"
70+
}
71+
$installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
72+
$installDir = "${{ matrix.openssl_root }}"
73+
74+
Write-Host "Downloading OpenSSL ${version} for ${arch}..."
75+
Write-Host "URL: $opensslUrl"
76+
Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath -UseBasicParsing
77+
78+
Write-Host "Downloaded file size: $(Get-Item $installerPath).Length bytes"
79+
80+
Write-Host "Installing OpenSSL ${version} for ${arch}..."
81+
Write-Host "Target directory: $installDir"
82+
83+
# Create target directory if it doesn't exist
84+
if (-not (Test-Path $installDir)) {
85+
New-Item -ItemType Directory -Path $installDir -Force | Out-Null
86+
Write-Host "Created directory: $installDir"
87+
}
88+
89+
$installArgs = @(
90+
"/i",
91+
"`"$installerPath`"",
92+
"/quiet",
93+
"INSTALLDIR=`"$installDir`"",
94+
"/norestart",
95+
"/L*v", # Enable verbose logging
96+
"`"$env:TEMP\openssl_install.log`""
97+
)
98+
99+
Write-Host "Running: msiexec $($installArgs -join ' ')"
100+
$process = Start-Process msiexec -ArgumentList $installArgs -Wait -PassThru
101+
102+
Write-Host "MSI install exit code: $($process.ExitCode)"
103+
104+
# Wait for installation to complete
105+
Start-Sleep -Seconds 5
106+
107+
# Check if installation succeeded
108+
$opensslExe = "$installDir\bin\openssl.exe"
109+
Write-Host "Checking for OpenSSL at: $opensslExe"
110+
111+
if (Test-Path $opensslExe) {
112+
Write-Host "✓ OpenSSL installed successfully"
113+
& $opensslExe version
114+
} else {
115+
Write-Host "✗ OpenSSL not found at expected location"
116+
Write-Host "Listing install directory contents:"
117+
Get-ChildItem -Path $installDir -Recurse -ErrorAction SilentlyContinue | Select-Object -First 20 FullName
118+
Write-Host "Install log (last 50 lines):"
119+
Get-Content "$env:TEMP\openssl_install.log" -Tail 50 -ErrorAction SilentlyContinue
120+
exit 1
121+
}
122+
123+
Write-Host "OpenSSL ${version} (${arch}) installation completed"
126124
127125
128126
- name: Verify OpenSSL cached

0 commit comments

Comments
 (0)