Skip to content

Commit fe94719

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

2 files changed

Lines changed: 70 additions & 101 deletions

File tree

.github/workflows/windows-msvc.yml

Lines changed: 65 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
vcredist_file: vc_redist.x64.exe
2424
artifact_suffix: win64
2525
cmake_gen: Visual Studio 17 2022
26-
vcpkg_triplet: x64-windows
26+
vcpkg_triplet: x64-windows-release
2727
- name: win32_msvc
2828
os: windows-2022
2929
build_type: Release
@@ -38,7 +38,7 @@ jobs:
3838
vcredist_file: vc_redist.x86.exe
3939
artifact_suffix: win32
4040
cmake_gen: Visual Studio 17 2022
41-
vcpkg_triplet: x86-windows
41+
vcpkg_triplet: x86-windows-release
4242
runs-on: ${{ matrix.os }}
4343
env:
4444
BUILD_TYPE: ${{ matrix.build_type }}
@@ -49,88 +49,45 @@ jobs:
4949
OPENSSL_CRYPTO_LIBRARY: ${{ matrix.openssl_root }}\lib
5050
steps:
5151
# Cache OpenSSL to speed up builds
52-
- name: '⚙️ Cache OpenSSL'
53-
id: cache-openssl
54-
uses: actions/cache@v3
55-
with:
56-
path: ${{ matrix.openssl_root }}
57-
key: Windows-OpenSSL-${{ matrix.openssl_arch }}-3.2.6
58-
59-
# Install OpenSSL 3.2.6 for both x86 and x64 architectures
60-
- name: Install OpenSSL ${{ matrix.openssl_arch }}
61-
if: steps.cache-openssl.outputs.cache-hit != 'true'
62-
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"
52+
# - name: '⚙️ Cache OpenSSL'
53+
# id: cache-openssl
54+
# uses: actions/cache@v3
55+
# with:
56+
# path: ${{ matrix.openssl_root }}
57+
# key: Windows-OpenSSL-${{ matrix.openssl_arch }}-3.2.6
58+
59+
# # Install OpenSSL 3.2.6 for both x86 and x64 architectures
60+
# - name: Install OpenSSL ${{ matrix.openssl_arch }}
61+
# shell: pwsh
62+
# run: |
63+
# $arch = "${{ matrix.openssl_arch }}"
64+
# $version = "3_2_6"
65+
# $opensslUrl = if ($arch -eq "x64") {
66+
# "https://slproweb.com/download/Win64OpenSSL-${version}.msi"
67+
# } else {
68+
# "https://slproweb.com/download/Win32OpenSSL-${version}.msi"
69+
# }
70+
# $installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
71+
# $installDir = "${{ matrix.openssl_root }}"
72+
73+
# # 下载安装包
74+
# Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath
75+
76+
# # 静默安装到指定目录
77+
# Start-Process msiexec.exe -ArgumentList "/i $installerPath /quiet /qn INSTALLDIR=$installDir" -Wait
78+
79+
# - name: Verify OpenSSL installation
80+
# run: |
81+
# openssl version
82+
# echo "OPENSSL_ROOT_DIR is: $env:OPENSSL_ROOT_DIR"
12683

12784

128-
- name: Verify OpenSSL cached
129-
if: steps.cache-openssl.outputs.cache-hit == 'true'
130-
shell: pwsh
131-
run: |
132-
Write-Host "Using cached OpenSSL:"
133-
& "${{ matrix.openssl_root }}\bin\openssl.exe" version
85+
# - name: Verify OpenSSL cached
86+
# if: steps.cache-openssl.outputs.cache-hit == 'true'
87+
# shell: pwsh
88+
# run: |
89+
# Write-Host "Using cached OpenSSL:"
90+
# & "${{ matrix.openssl_root }}\bin\openssl.exe" version
13491

13592
- name: '⚙️ Cache Qt'
13693
id: cache-qt
@@ -150,24 +107,24 @@ jobs:
150107
# cached: 'false'
151108
cached: ${{ steps.cache-qt.outputs.cache-hit }}
152109

153-
- name: '⚙️ Cache vcpkg'
154-
id: cache-vcpkg
155-
uses: actions/cache@v3
156-
with:
157-
path: |
158-
${{ github.workspace }}/vcpkg
159-
~/.vcpkg
160-
key: Windows-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles('**/vcpkg.json') }}
161-
restore-keys: |
162-
Windows-vcpkg-${{ matrix.vcpkg_triplet }}-
163-
164-
- name: Install vcpkg
165-
if: steps.cache-vcpkg.outputs.cache-hit != 'true'
166-
shell: pwsh
167-
run: |
168-
git clone https://github.com/Microsoft/vcpkg.git
169-
.\vcpkg\bootstrap-vcpkg.bat -disableMetrics
170-
echo "VCPKG_INSTALLED_DIR=$env:GITHUB_WORKSPACE\vcpkg" >> $env:GITHUB_ENV
110+
# - name: '⚙️ Cache vcpkg'
111+
# id: cache-vcpkg
112+
# uses: actions/cache@v3
113+
# with:
114+
# path: |
115+
# ${{ github.workspace }}/vcpkg
116+
# ~/.vcpkg
117+
# key: Windows-vcpkg-${{ matrix.vcpkg_triplet }}-${{ hashFiles('**/vcpkg.json') }}
118+
# restore-keys: |
119+
# Windows-vcpkg-${{ matrix.vcpkg_triplet }}-
120+
121+
# - name: Install vcpkg
122+
# if: steps.cache-vcpkg.outputs.cache-hit != 'true'
123+
# shell: pwsh
124+
# run: |
125+
# git clone https://github.com/Microsoft/vcpkg.git
126+
# .\vcpkg\bootstrap-vcpkg.bat -disableMetrics
127+
# echo "VCPKG_INSTALLED_DIR=$env:GITHUB_WORKSPACE\vcpkg" >> $env:GITHUB_ENV
171128

172129
# Use CMake 3.31.x for better OpenSSL 3.x compatibility while supporting VS 2019
173130
- name: Setup cmake
@@ -182,6 +139,14 @@ jobs:
182139
path: source
183140
fetch-depth: 0
184141

142+
- name: Build and cache vcpkg
143+
id: vcpkg
144+
uses: johnwason/vcpkg-action@v7
145+
with:
146+
manifest-dir: ${{ github.workspace }}\source
147+
triplet: ${{matrix.vcpkg_triplet}}
148+
token: ${{ github.token }}
149+
185150
- name: msvc-build
186151
id: build
187152
shell: cmd

cmake/vcpkg.json.in

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
"name": "dde-cooperation",
55
"version": "@APP_VERSION@",
66
"dependencies": [
7-
"zlib"
7+
"zlib",
8+
{
9+
"name": "openssl",
10+
"version": "3.2.6"
11+
}
812
]
913
}

0 commit comments

Comments
 (0)