@@ -13,30 +13,87 @@ jobs:
1313 os : windows-2022
1414 build_type : Release
1515 compiler_type : msvc2019_64
16+ build_arch : x64
1617 msvc_arch : x64
1718 qt_arch : win64_msvc2019_64
1819 qt_version : 5.15.2
1920 qt_target : desktop
21+ openssl_root : C:\Program Files\OpenSSL-Win64
22+ cmake_gen : Visual Studio 17 2022
23+ vcpkg_triplet : x64-windows-release
24+ - name : win32_msvc
25+ os : windows-2022
26+ build_type : Release
27+ compiler_type : msvc2019
28+ build_arch : x86
29+ msvc_arch : Win32
30+ qt_arch : win32_msvc2019
31+ qt_version : 5.15.2
32+ qt_target : desktop
33+ openssl_root : C:\Program Files (x86)\OpenSSL-Win32
34+ cmake_gen : Visual Studio 17 2022
35+ vcpkg_triplet : x86-windows
2036 runs-on : ${{ matrix.os }}
2137 env :
2238 BUILD_TYPE : ${{ matrix.build_type }}
2339 COMPILER_TYPE : ${{ matrix.compiler_type }}
2440 QT_VERSION : ${{ matrix.qt_version }}
25- OPENSSL_ROOT_DIR : C:\Program Files\OpenSSL
26- OPENSSL_INCLUDE_DIR : C:\Program Files\OpenSSL \include
27- OPENSSL_CRYPTO_LIBRARY : C:\Program Files\OpenSSL \lib
41+ OPENSSL_ROOT_DIR : ${{ matrix.openssl_root }}
42+ OPENSSL_INCLUDE_DIR : ${{ matrix.openssl_root }} \include
43+ OPENSSL_CRYPTO_LIBRARY : ${{ matrix.openssl_root }} \lib
2844 steps :
29- # force 6.2.2 version of Inno Setup
30- # - name: Install Inno Setup
45+ # Cache OpenSSL to speed up builds
46+ # - name: '⚙️ Cache OpenSSL'
47+ # id: cache-openssl
48+ # uses: actions/cache@v3
49+ # with:
50+ # path: ${{ matrix.openssl_root }}
51+ # key: Windows-OpenSSL-${{ matrix.build_arch }}-3.2.6
52+
53+ # # Install OpenSSL 3.2.6 for both x86 and x64 architectures
54+ # - name: Install OpenSSL ${{ matrix.build_arch }}
55+ # shell: pwsh
56+ # run: |
57+ # $arch = "${{ matrix.build_arch }}"
58+ # $version = "3_2_6"
59+ # $opensslUrl = if ($arch -eq "x64") {
60+ # "https://slproweb.com/download/Win64OpenSSL-${version}.msi"
61+ # } else {
62+ # "https://slproweb.com/download/Win32OpenSSL-${version}.msi"
63+ # }
64+ # $installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
65+ # $installDir = "${{ matrix.openssl_root }}"
66+
67+ # # 下载安装包
68+ # Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath
69+
70+ # # 静默安装到指定目录并等待完成
71+ # Start-Process msiexec.exe -ArgumentList "/i $installerPath /quiet /qn INSTALLDIR=$installDir"
72+
73+ # # 等待安装完全完成
74+ # Start-Sleep -Seconds 10
75+
76+ # - name: Verify OpenSSL installation
77+ # run: |
78+ # openssl version
79+ # echo "OPENSSL_ROOT_DIR is: $env:OPENSSL_ROOT_DIR"
80+
81+
82+ # - name: Verify OpenSSL cached
83+ # if: steps.cache-openssl.outputs.cache-hit == 'true'
84+ # shell: pwsh
3185 # run: |
32- # choco install innosetup --version 6.2.2 --allow-downgrade -y
86+ # Write-Host "Using cached OpenSSL:"
87+ # & "${{ matrix.openssl_root }}\bin\openssl.exe" version
3388
3489 - name : ' ⚙️ Cache Qt'
3590 id : cache-qt
3691 uses : actions/cache@v3
3792 with :
38- path : ..\Qt
39- key : Windows-QtCache-${{ env.QT_VERSION }}
93+ path : ${{ env.HOME }}/Qt
94+ key : Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-${{ matrix.qt_arch }}
95+ restore-keys : |
96+ Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-
4097
4198 - name : Install Qt ${{ env.QT_VERSION }}
4299 uses : jurplel/install-qt-action@v3
@@ -46,10 +103,9 @@ jobs:
46103 target : ${{ matrix.qt_target }}
47104 arch : ${{ matrix.qt_arch }}
48105 # modules: 'qt5compat'
49- # cached: 'false'
50106 cached : ${{ steps.cache-qt.outputs.cache-hit }}
51107
52- # Use CMake 3.31.x for better OpenSSL 3.x compatibility while supporting VS 2022
108+ # Use CMake 3.31.x for better OpenSSL 3.x compatibility while supporting VS 2019
53109 - name : Setup cmake
54110 uses : lukka/get-cmake@latest
55111 with :
@@ -62,24 +118,36 @@ jobs:
62118 path : source
63119 fetch-depth : 0
64120
121+ - name : Build and cache vcpkg
122+ id : vcpkg
123+ uses : johnwason/vcpkg-action@v7
124+ with :
125+ pkgs : zlib openssl
126+ # manifest-dir: ${{ github.workspace }}\source
127+ extra-args : --classic --host-triplet=${{matrix.vcpkg_triplet}}
128+ triplet : ${{matrix.vcpkg_triplet}}
129+ token : ${{ github.token }}
130+ revision : master
131+
65132 - name : msvc-build
66133 id : build
67134 shell : cmd
68135 env :
136+ build_arch : ${{ matrix.build_arch }}
69137 vc_arch : ${{ matrix.msvc_arch }}
70- cmake_gen : Visual Studio 17 2022
138+ cmake_gen : ${{ matrix.cmake_gen }}
71139 COO_PROJECT : dde-cooperation
72140 DT_PROJECT : data-transfer
73141 BONJOUR_SDK : ${{ github.workspace }}\source\3rdparty\ext\BonjourSDK
74142 run : |
75- REM Use Visual Studio 2022 Enterprise (pre-installed on Windows 2022 runner)
143+ REM Use Visual Studio 2022 Community (pre-installed on Windows 2022 runner)
76144 set "VS2022_PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
77145 if not exist "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" (
78146 echo Visual Studio 2022 Enterprise not found at expected location!
79147 exit /b 1
80148 )
81149 echo Using Visual Studio 2022 at: %VS2022_PATH%
82- call "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %vc_arch %
150+ call "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %build_arch %
83151
84152 REM Initialize OpenSSL environment (based on start.bat logic)
85153 echo ============== OpenSSL Initialization ==============
@@ -108,45 +176,40 @@ jobs:
108176 mkdir installer-inno
109177 echo Current working directory: %CD%
110178 echo Source directory: %GITHUB_WORKSPACE%\source
111- if exist "%GITHUB_WORKSPACE%\source\CMakeLists.txt" (
112- echo Found CMakeLists.txt in source directory
113- cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% -D APP_VERSION="${{ github.ref_name }}" "%GITHUB_WORKSPACE%\source"
114- ) else (
115- echo ERROR: CMakeLists.txt not found in source directory
116- dir "%GITHUB_WORKSPACE%\source"
117- exit /b 1
118- )
179+ echo Using vcpkg triplet: ${{ matrix.vcpkg_triplet }}
180+ echo Vcpkg toolchain file: %GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake
181+
182+ cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% ^
183+ -D CMAKE_TOOLCHAIN_FILE="%GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake" ^
184+ -D VCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} ^
185+ -D APP_VERSION="${{ github.ref_name }}" "%GITHUB_WORKSPACE%\source"
186+
119187 cmake --build . --config %BUILD_TYPE%
120188
121189 echo ------------copy files to output directory------------
122190
123- if exist output\%BUILD_TYPE% (
124- copy output\%BUILD_TYPE%\* output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
125- REM del output\%COO_PROJECT%\%BUILD_TYPE%\quazip* > NUL
126-
127- copy "%OPENSSL_ROOT_DIR%\bin\libcrypto-3-x64.dll" output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
128- copy "%OPENSSL_ROOT_DIR%\bin\libssl-3-x64.dll" output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
129-
130- mkdir installer-inno\%COO_PROJECT%
131- copy "%BONJOUR_SDK%\Bonjour64.msi" installer-inno\%COO_PROJECT%\ > NUL
132- if exist output\%COO_PROJECT%\%BUILD_TYPE%\vc_redist.x64.exe (
133- move output\%COO_PROJECT%\%BUILD_TYPE%\vc_redist.x64.exe installer-inno\%COO_PROJECT%\ > NUL
134- )
135-
136-
137- REM copy output\%BUILD_TYPE%\quazip* output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
138-
139- copy "%OPENSSL_ROOT_DIR%\bin\libcrypto-3-x64.dll" output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
140- copy "%OPENSSL_ROOT_DIR%\bin\libssl-3-x64.dll" output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
141- mkdir installer-inno\%DT_PROJECT%
142- copy "%B_BONJOUR%\Bonjour64.msi" installer-inno\%DT_PROJECT%\ > NUL
143- if exist output\%DT_PROJECT%\%BUILD_TYPE%\vc_redist.x64.exe (
144- move output\%DT_PROJECT%\%BUILD_TYPE%\vc_redist.x64.exe installer-inno\%DT_PROJECT%\ > NUL
145- )
191+ REM Set architecture-specific file names
192+ if "%build_arch%"=="x86" (
193+ set OPENSSL_CRYPTO=libcrypto-3.dll
194+ set OPENSSL_SSL=libssl-3.dll
195+ set BONJOUR_FILE=Bonjour.msi
146196 ) else (
147- echo Remember to copy supporting binaries and configuration files!
197+ set OPENSSL_CRYPTO=libcrypto-3-x64.dll
198+ set OPENSSL_SSL=libssl-3-x64.dll
199+ set BONJOUR_FILE=Bonjour64.msi
148200 )
149201
202+ copy output\%BUILD_TYPE%\* output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
203+ del output\%COO_PROJECT%\%BUILD_TYPE%\quazip* > NUL
204+
205+ copy "%OPENSSL_ROOT_DIR%\%OPENSSL_CRYPTO%" output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
206+ copy "%OPENSSL_ROOT_DIR%\%OPENSSL_SSL%" output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
207+ copy "%BONJOUR_SDK%\%BONJOUR_FILE%" output\%COO_PROJECT%\%BUILD_TYPE%\ > NUL
208+
209+ copy output\%BUILD_TYPE%\quazip* output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
210+ copy "%OPENSSL_ROOT_DIR%\%OPENSSL_CRYPTO%" output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
211+ copy "%OPENSSL_ROOT_DIR%\%OPENSSL_SSL%" output\%DT_PROJECT%\%BUILD_TYPE%\ > NUL
212+
150213 echo Build completed successfully
151214
152215 - name : Inno Setup data-transfer
@@ -159,19 +222,12 @@ jobs:
159222 with :
160223 filepath : build/dde-cooperation-setup.iss
161224
162- - name : Make Installer Directories
163- run : |
164- move build/installer-inno/deepin-cooperation-* build/installer-inno/dde-cooperation/ > NUL
165- powershell -Command "Compress-Archive -Path build/installer-inno/dde-cooperation/* -DestinationPath build/installer-inno/dde-cooperation.zip"
166- move build/installer-inno/deepin-datatransfer-* build/installer-inno/data-transfer/ > NUL
167- powershell -Command "Compress-Archive -Path build/installer-inno/data-transfer/* -DestinationPath build/installer-inno/deepin-data-transfer.zip"
168-
169225 - name : Create Release
170226 uses : softprops/action-gh-release@v1
171227 if : startsWith(github.ref, 'refs/tags/')
172228 env :
173229 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
174230 with :
175- files : build/installer-inno/*.zip
231+ files : build/installer-inno/*.exe
176232 generate_release_notes : true
177233 draft : true
0 commit comments