Skip to content

Commit 5b186fc

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

2 files changed

Lines changed: 80 additions & 92 deletions

File tree

.github/workflows/windows-msvc.yml

Lines changed: 73 additions & 91 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
@@ -58,71 +58,31 @@ jobs:
5858

5959
# Install OpenSSL 3.2.6 for both x86 and x64 architectures
6060
- name: Install OpenSSL ${{ matrix.openssl_arch }}
61-
if: steps.cache-openssl.outputs.cache-hit != 'true'
61+
shell: pwsh
6262
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"
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"
78+
79+
# 等待安装完全完成
80+
Start-Sleep -Seconds 10
81+
82+
- name: Verify OpenSSL installation
83+
run: |
84+
openssl version
85+
echo "OPENSSL_ROOT_DIR is: $env:OPENSSL_ROOT_DIR"
12686
12787
12888
- name: Verify OpenSSL cached
@@ -136,8 +96,10 @@ jobs:
13696
id: cache-qt
13797
uses: actions/cache@v3
13898
with:
139-
path: ..\Qt
140-
key: Windows-QtCache-${{ env.QT_VERSION }}
99+
path: ${{ env.HOME }}/Qt
100+
key: Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-${{ matrix.qt_arch }}
101+
restore-keys: |
102+
Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-
141103
142104
- name: Install Qt ${{ env.QT_VERSION }}
143105
uses: jurplel/install-qt-action@v3
@@ -147,28 +109,8 @@ jobs:
147109
target: ${{ matrix.qt_target }}
148110
arch: ${{ matrix.qt_arch }}
149111
# modules: 'qt5compat'
150-
# cached: 'false'
151112
cached: ${{ steps.cache-qt.outputs.cache-hit }}
152113

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
171-
172114
# Use CMake 3.31.x for better OpenSSL 3.x compatibility while supporting VS 2019
173115
- name: Setup cmake
174116
uses: lukka/get-cmake@latest
@@ -182,6 +124,17 @@ jobs:
182124
path: source
183125
fetch-depth: 0
184126

127+
- name: Build and cache vcpkg
128+
id: vcpkg
129+
uses: johnwason/vcpkg-action@v7
130+
with:
131+
pkgs: zlib
132+
# manifest-dir: ${{ github.workspace }}\source
133+
extra-args: --classic --host-triplet=${{matrix.vcpkg_triplet}}
134+
triplet: ${{matrix.vcpkg_triplet}}
135+
token: ${{ github.token }}
136+
revision: master
137+
185138
- name: msvc-build
186139
id: build
187140
shell: cmd
@@ -307,11 +260,40 @@ jobs:
307260
filepath: build/dde-cooperation-setup.iss
308261

309262
- name: Make Installer Directories
263+
shell: pwsh
310264
run: |
311-
move build/installer-inno/deepin-cooperation-* build/installer-inno/dde-cooperation/ > NUL
312-
powershell -Command "Compress-Archive -Path build/installer-inno/dde-cooperation/* -DestinationPath build/installer-inno/dde-cooperation.zip"
313-
move build/installer-inno/deepin-datatransfer-* build/installer-inno/data-transfer/ > NUL
314-
powershell -Command "Compress-Archive -Path build/installer-inno/data-transfer/* -DestinationPath build/installer-inno/deepin-data-transfer.zip"
265+
$archSuffix = "${{ matrix.artifact_suffix }}" # win64 or win32
266+
$cooperationDir = "build/installer-inno/dde-cooperation-${archSuffix}"
267+
$transferDir = "build/installer-inno/data-transfer-${archSuffix}"
268+
$cooperationZip = "build/installer-inno/dde-cooperation-${archSuffix}.zip"
269+
$transferZip = "build/installer-inno/deepin-data-transfer-${archSuffix}.zip"
270+
271+
# Move cooperation files
272+
if (Test-Path "build/installer-inno/deepin-cooperation-*") {
273+
Move-Item -Path "build/installer-inno/deepin-cooperation-*" -Destination $cooperationDir -Force
274+
Write-Host "Moved cooperation files to: $cooperationDir"
275+
}
276+
277+
# Move data-transfer files
278+
if (Test-Path "build/installer-inno/deepin-datatransfer-*") {
279+
Move-Item -Path "build/installer-inno/deepin-datatransfer-*" -Destination $transferDir -Force
280+
Write-Host "Moved data-transfer files to: $transferDir"
281+
}
282+
283+
# Create archives
284+
if (Test-Path $cooperationDir) {
285+
Compress-Archive -Path "$cooperationDir/*" -DestinationPath $cooperationZip -Force
286+
Write-Host "Created: $cooperationZip"
287+
}
288+
289+
if (Test-Path $transferDir) {
290+
Compress-Archive -Path "$transferDir/*" -DestinationPath $transferZip -Force
291+
Write-Host "Created: $transferZip"
292+
}
293+
294+
# List created files
295+
Write-Host "Installer archives:"
296+
Get-ChildItem -Path "build/installer-inno/*.zip" | Select-Object Name, Length, LastWriteTime
315297
316298
- name: Create Release
317299
uses: softprops/action-gh-release@v1

cmake/vcpkg.json.in

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

0 commit comments

Comments
 (0)