Skip to content

fix(network): filter virtual network interfaces correctly on Windows #96

fix(network): filter virtual network interfaces correctly on Windows

fix(network): filter virtual network interfaces correctly on Windows #96

Workflow file for this run

name: Windows MSVC Release
on:
push:
tags:
- "*"
jobs:
build_and_release:
strategy:
matrix:
include:
- name: win64_msvc
os: windows-2022
build_type: Release
compiler_type: msvc2019_64
build_arch: x64
msvc_arch: x64
qt_arch: win64_msvc2019_64
qt_version: 5.15.2
qt_target: desktop
openssl_root: C:\Program Files\OpenSSL-Win64
cmake_gen: Visual Studio 17 2022
vcpkg_triplet: x64-windows-release
- name: win32_msvc
os: windows-2022
build_type: Release
compiler_type: msvc2019
build_arch: x86
msvc_arch: Win32
qt_arch: win32_msvc2019
qt_version: 5.15.2
qt_target: desktop
openssl_root: C:\Program Files (x86)\OpenSSL-Win32
cmake_gen: Visual Studio 17 2022
vcpkg_triplet: x86-windows
runs-on: ${{ matrix.os }}
env:
BUILD_TYPE: ${{ matrix.build_type }}
COMPILER_TYPE: ${{ matrix.compiler_type }}
QT_VERSION: ${{ matrix.qt_version }}
OPENSSL_ROOT_DIR: ${{ matrix.openssl_root }}
OPENSSL_INCLUDE_DIR: ${{ matrix.openssl_root }}\include
OPENSSL_CRYPTO_LIBRARY: ${{ matrix.openssl_root }}\lib
steps:
# Cache OpenSSL to speed up builds
# - name: '⚙️ Cache OpenSSL'
# id: cache-openssl
# uses: actions/cache@v3
# with:
# path: ${{ matrix.openssl_root }}
# key: Windows-OpenSSL-${{ matrix.build_arch }}-3.2.6
# # Install OpenSSL 3.2.6 for both x86 and x64 architectures
# - name: Install OpenSSL ${{ matrix.build_arch }}
# shell: pwsh
# run: |
# $arch = "${{ matrix.build_arch }}"
# $version = "3_2_6"
# $opensslUrl = if ($arch -eq "x64") {
# "https://slproweb.com/download/Win64OpenSSL-${version}.msi"
# } else {
# "https://slproweb.com/download/Win32OpenSSL-${version}.msi"
# }
# $installerPath = "$env:TEMP\OpenSSL-${version}_${arch}.msi"
# $installDir = "${{ matrix.openssl_root }}"
# # 下载安装包
# Invoke-WebRequest -Uri $opensslUrl -OutFile $installerPath
# # 静默安装到指定目录并等待完成
# Start-Process msiexec.exe -ArgumentList "/i $installerPath /quiet /qn INSTALLDIR=$installDir"
# # 等待安装完全完成
# Start-Sleep -Seconds 10
# - name: Verify OpenSSL installation
# run: |
# openssl version
# echo "OPENSSL_ROOT_DIR is: $env:OPENSSL_ROOT_DIR"
# - name: Verify OpenSSL cached
# if: steps.cache-openssl.outputs.cache-hit == 'true'
# shell: pwsh
# run: |
# Write-Host "Using cached OpenSSL:"
# & "${{ matrix.openssl_root }}\bin\openssl.exe" version
- name: '⚙️ Cache Qt'
id: cache-qt
uses: actions/cache@v3
with:
path: ${{ env.HOME }}/Qt
key: Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-${{ matrix.qt_arch }}
restore-keys: |
Windows-${{ matrix.os }}-Qt-${{ env.QT_VERSION }}-
- name: Install Qt ${{ env.QT_VERSION }}
uses: jurplel/install-qt-action@v3
with:
aqtversion: '==3.1.*'
version: ${{ env.QT_VERSION }}
target: ${{ matrix.qt_target }}
arch: ${{ matrix.qt_arch }}
# modules: 'qt5compat'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
# Use CMake 3.31.x for better OpenSSL 3.x compatibility while supporting VS 2022
- name: Setup cmake
uses: lukka/get-cmake@latest
with:
cmakeVersion: 3.31.5
ninjaVersion: 1.11.1
- name: Checkout
uses: actions/checkout@v4
with:
path: source
fetch-depth: 0
- name: Build and cache vcpkg
id: vcpkg
uses: johnwason/vcpkg-action@v7
with:
pkgs: zlib openssl
# manifest-dir: ${{ github.workspace }}\source
extra-args: --classic --host-triplet=${{matrix.vcpkg_triplet}}
triplet: ${{matrix.vcpkg_triplet}}
token: ${{ github.token }}
revision: master
- name: msvc-build
id: build
shell: cmd
env:
build_arch: ${{ matrix.build_arch }}
vc_arch: ${{ matrix.msvc_arch }}
cmake_gen: ${{ matrix.cmake_gen }}
COO_PROJECT: dde-cooperation
DT_PROJECT: data-transfer
BONJOUR_SDK: ${{ github.workspace }}\source\3rdparty\ext\BonjourSDK
VCPKG_INSTALLED: ${{ github.workspace }}\vcpkg\installed\${{ matrix.vcpkg_triplet }}
run: |
REM Use Visual Studio 2022 Enterprise (pre-installed on Windows 2022 runner)
set "VS2022_PATH=C:\Program Files\Microsoft Visual Studio\2022\Enterprise"
if not exist "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" (
echo Visual Studio 2022 Enterprise not found at expected location!
exit /b 1
)
echo Using Visual Studio 2022 at: %VS2022_PATH%
call "%VS2022_PATH%\VC\Auxiliary\Build\vcvarsall.bat" %build_arch%
REM Initialize OpenSSL environment (based on start.bat logic)
echo ============== OpenSSL Initialization ==============
echo Setting up OpenSSL environment...
REM Add OpenSSL bin directory to PATH (following start.bat pattern)
set "PATH=%PATH%;%OPENSSL_ROOT_DIR%\bin"
echo Updated PATH: %OPENSSL_ROOT_DIR%\bin added to PATH
REM Verify OpenSSL installation (like start.bat does)
echo.
echo Verifying OpenSSL installation:
openssl version -a
echo.
echo OpenSSL environment ready
echo ================================================
REM Display key OpenSSL environment variables
echo OpenSSL Configuration:
echo OPENSSL_ROOT_DIR: %OPENSSL_ROOT_DIR%
echo OPENSSL_INCLUDE_DIR: %OPENSSL_INCLUDE_DIR%
echo OPENSSL_CRYPTO_LIBRARY: %OPENSSL_CRYPTO_LIBRARY%
echo.
mkdir build && cd build
mkdir installer-inno
echo Current working directory: %CD%
echo Source directory: %GITHUB_WORKSPACE%\source
echo Using vcpkg triplet: ${{ matrix.vcpkg_triplet }}
echo Vcpkg toolchain file: %GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake -G "%cmake_gen%" -A %vc_arch% -D CMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-D CMAKE_TOOLCHAIN_FILE="%GITHUB_WORKSPACE%\vcpkg\scripts\buildsystems\vcpkg.cmake" ^
-D VCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} ^
-D APP_VERSION="${{ github.ref_name }}" "%GITHUB_WORKSPACE%\source"
cmake --build . --config %BUILD_TYPE%
echo ------------copy files to output directory------------
REM Set architecture-specific file names
if "%build_arch%"=="x86" (
set OPENSSL_CRYPTO=libcrypto-3.dll
set OPENSSL_SSL=libssl-3.dll
set BONJOUR_FILE=Bonjour.msi
) else (
set OPENSSL_CRYPTO=libcrypto-3-x64.dll
set OPENSSL_SSL=libssl-3-x64.dll
set BONJOUR_FILE=Bonjour64.msi
)
REM Create output directories if they don't exist
if not exist "output\%COO_PROJECT%\%BUILD_TYPE%" mkdir "output\%COO_PROJECT%\%BUILD_TYPE%"
if not exist "output\%DT_PROJECT%\%BUILD_TYPE%" mkdir "output\%DT_PROJECT%\%BUILD_TYPE%"
REM Copy files for cooperation
if exist "output\%BUILD_TYPE%\*" (
copy output\%BUILD_TYPE%\* output\%COO_PROJECT%\%BUILD_TYPE%\
REM quazip is only used by data-transfer, not cooperation
if exist "output\%COO_PROJECT%\%BUILD_TYPE%\quazip*" del output\%COO_PROJECT%\%BUILD_TYPE%\quazip*
)
REM Copy OpenSSL DLLs from vcpkg installed directory
if exist "%VCPKG_INSTALLED%\bin\%OPENSSL_CRYPTO%" (
copy "%VCPKG_INSTALLED%\bin\%OPENSSL_CRYPTO%" output\%COO_PROJECT%\%BUILD_TYPE%\
) else (
echo WARNING: OpenSSL DLL not found in vcpkg: %VCPKG_INSTALLED%\bin\%OPENSSL_CRYPTO%
)
if exist "%VCPKG_INSTALLED%\bin\%OPENSSL_SSL%" (
copy "%VCPKG_INSTALLED%\bin\%OPENSSL_SSL%" output\%COO_PROJECT%\%BUILD_TYPE%\
) else (
echo WARNING: OpenSSL DLL not found in vcpkg: %VCPKG_INSTALLED%\bin\%OPENSSL_SSL%
)
REM Copy Bonjour SDK
if exist "%BONJOUR_SDK%\%BONJOUR_FILE%" (
copy "%BONJOUR_SDK%\%BONJOUR_FILE%" output\%COO_PROJECT%\%BUILD_TYPE%\
) else (
echo WARNING: Bonjour file not found: %BONJOUR_SDK%\%BONJOUR_FILE%
)
REM Copy files for data-transfer
REM quazip is only built and used by data-transfer
if exist "output\%BUILD_TYPE%\quazip.dll" (
copy output\%BUILD_TYPE%\quazip.dll output\%DT_PROJECT%\%BUILD_TYPE%\
) else (
echo WARNING: quazip.dll not found in output\%BUILD_TYPE%
)
if exist "%VCPKG_INSTALLED%\bin\%OPENSSL_CRYPTO%" (
copy "%VCPKG_INSTALLED%\bin\%OPENSSL_CRYPTO%" output\%DT_PROJECT%\%BUILD_TYPE%\
)
if exist "%VCPKG_INSTALLED%\bin\%OPENSSL_SSL%" (
copy "%VCPKG_INSTALLED%\bin\%OPENSSL_SSL%" output\%DT_PROJECT%\%BUILD_TYPE%\
)
echo Build completed successfully
- name: Inno Setup data-transfer
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
with:
filepath: build/deepin-data-transfer-setup.iss
- name: Inno Setup cooperation
uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
with:
filepath: build/dde-cooperation-setup.iss
- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: build/installer-inno/*.exe
generate_release_notes: true
draft: true