mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
267 lines
8.6 KiB
YAML
267 lines
8.6 KiB
YAML
name: Build Windows
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Build version (e.g., v1.2.3)"
|
|
required: true
|
|
default: "dev"
|
|
workflow_call:
|
|
inputs:
|
|
version:
|
|
description: "Build version (e.g., v1.2.3)"
|
|
required: true
|
|
type: string
|
|
default: "dev"
|
|
env:
|
|
QT_VERSION: "6.8.3"
|
|
GO_VERSION: "1.23.4"
|
|
LIBPLIST_VER: "2.7.0"
|
|
LIBTATSU_VER: "1.0.5"
|
|
LIBIMOBILEDEVICE_GLUE_VER: "1.3.2"
|
|
LIBIMOBILEDEVICE_VER: "1.4.0"
|
|
LIBIRECOVERY_VER: "1.3.1"
|
|
LIBUSBMUXD_VER: "2.1.1"
|
|
|
|
jobs:
|
|
build-windows:
|
|
runs-on: windows-2022
|
|
defaults:
|
|
run:
|
|
shell: msys2 {0}
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: "recursive"
|
|
|
|
- name: Setup MSYS2
|
|
uses: msys2/setup-msys2@v2
|
|
with:
|
|
msystem: mingw64
|
|
release: false
|
|
update: false
|
|
|
|
- name: Use msys2 archive
|
|
shell: pwsh
|
|
run: |
|
|
$date = "2025-06-22"
|
|
& "scripts/get-msys2-archive.ps1" -Date $date
|
|
|
|
- name: Install deps using pacman
|
|
run: |
|
|
pacman -S --needed --noconfirm \
|
|
coreutils \
|
|
base-devel \
|
|
git \
|
|
make \
|
|
libtool \
|
|
autoconf \
|
|
automake-wrapper \
|
|
p7zip \
|
|
mingw-w64-x86_64-gcc \
|
|
mingw-w64-x86_64-cmake \
|
|
mingw-w64-x86_64-pugixml \
|
|
mingw-w64-x86_64-libusb \
|
|
mingw-w64-x86_64-qrencode \
|
|
mingw-w64-x86_64-curl \
|
|
mingw-w64-x86_64-openssl \
|
|
mingw-w64-x86_64-libzip \
|
|
mingw-w64-x86_64-go \
|
|
mingw-w64-x86_64-gstreamer \
|
|
mingw-w64-x86_64-gst-plugins-base \
|
|
mingw-w64-x86_64-gst-plugins-good \
|
|
mingw-w64-x86_64-gst-plugins-bad \
|
|
mingw-w64-x86_64-gst-plugins-ugly \
|
|
mingw-w64-x86_64-gst-libav \
|
|
mingw-w64-x86_64-libheif \
|
|
mingw-w64-x86_64-libarchive
|
|
|
|
- uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: "8.0.x"
|
|
|
|
- name: Install WiX Toolset and Extensions
|
|
shell: pwsh
|
|
run: |
|
|
dotnet tool install --global wix --version 4.0.5
|
|
wix extension add --global WixToolset.UI.wixext/4.0.5
|
|
|
|
- name: Set PKG_CONFIG environment variable
|
|
run: echo "PKG_CONFIG_EXECUTABLE=C:/msys64/mingw64/bin/pkg-config.exe" >> $GITHUB_ENV
|
|
|
|
- name: Install Qt
|
|
uses: jurplel/install-qt-action@v3
|
|
with:
|
|
version: ${{ env.QT_VERSION }}
|
|
modules: "qtmultimedia qtlocation qtpositioning qtserialport"
|
|
arch: win64_mingw
|
|
|
|
- name: Install WinFsp
|
|
shell: pwsh
|
|
run: |
|
|
$maxRetries = 3
|
|
$retryDelaySeconds = 10
|
|
$attempt = 0
|
|
$success = $false
|
|
|
|
while ($attempt -lt $maxRetries -and -not $success) {
|
|
$attempt++
|
|
Write-Host "Attempt $attempt to install WinFsp..."
|
|
choco install winfsp -y
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "WinFsp installed successfully on attempt $attempt."
|
|
$success = $true
|
|
} else {
|
|
Write-Warning "WinFsp installation failed on attempt $attempt (exit code: $LASTEXITCODE)."
|
|
if ($attempt -lt $maxRetries) {
|
|
Write-Host "Retrying in $retryDelaySeconds seconds..."
|
|
Start-Sleep -Seconds $retryDelaySeconds
|
|
}
|
|
}
|
|
}
|
|
|
|
if (-not $success) {
|
|
Write-Error "Failed to install WinFsp after $maxRetries attempts."
|
|
exit 1 # Explicitly fail the step if all retries fail
|
|
}
|
|
|
|
- name: Download and Extract Bonjour SDK
|
|
run: |
|
|
wget "https://github.com/tempx-x/bonjour-sdk/raw/refs/heads/main/bonjoursdksetup.exe" -O bonjour-sdk.exe
|
|
|
|
EXPECTED_HASH="4ff2aae8205aec31b06743782cfcadce"
|
|
ACTUAL_HASH=$(md5sum bonjour-sdk.exe | awk '{print $1}')
|
|
|
|
echo "Expected MD5: $EXPECTED_HASH"
|
|
echo "Actual MD5: $ACTUAL_HASH"
|
|
|
|
if [ "$ACTUAL_HASH" != "$EXPECTED_HASH" ]; then
|
|
echo "::error::Checksum mismatch!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Checksum verified. Extracting installer..."
|
|
7z x bonjour-sdk.exe -oBonjourInstaller
|
|
|
|
- name: Install Bonjour Runtime
|
|
shell: powershell
|
|
run: |
|
|
$currentPath = Get-Location
|
|
$msiFilePath = Join-Path -Path $currentPath -ChildPath "BonjourInstaller\Bonjour64.msi"
|
|
$msiexecArguments = "/i `"$msiFilePath`" /qn"
|
|
Write-Host "Installing Bonjour Runtime..."
|
|
Start-Process msiexec -ArgumentList $msiexecArguments -NoNewWindow -Wait
|
|
|
|
- name: Install Bonjour SDK
|
|
shell: powershell
|
|
run: |
|
|
$currentPath = Get-Location
|
|
$msiFilePath = Join-Path -Path $currentPath -ChildPath "BonjourInstaller\BonjourSDK64.msi"
|
|
$msiexecArguments = "/i `"$msiFilePath`" /qn"
|
|
Write-Host "Installing Bonjour SDK..."
|
|
Start-Process msiexec -ArgumentList $msiexecArguments -NoNewWindow -Wait
|
|
|
|
"BONJOUR_SDK_HOME=C:/Program Files/Bonjour SDK" | Out-File -FilePath $env:GITHUB_ENV -Append
|
|
|
|
- name: Compile additional dependencies
|
|
run: |
|
|
git clone https://github.com/lxqt/lxqt-build-tools.git
|
|
pushd lxqt-build-tools
|
|
mkdir build && cd build
|
|
cmake .. -DCMAKE_PREFIX_PATH="$Qt6_DIR"
|
|
cmake --install . --prefix "C:\lxqt"
|
|
popd
|
|
|
|
git clone https://github.com/uncor3/qtermwidget.git
|
|
pushd qtermwidget
|
|
mkdir build && cd build
|
|
cmake .. -DCMAKE_PREFIX_PATH="$Qt6_DIR;C:\lxqt" -DCMAKE_INSTALL_PREFIX="C:\lxqt"
|
|
cmake --build . --parallel
|
|
cmake --install .
|
|
popd
|
|
|
|
- name: Build libimobiledevice suite (versioned tarballs)
|
|
run: |
|
|
set -euo pipefail
|
|
workspace="$PWD"
|
|
tmp="$PWD/_tmp_libs"
|
|
mkdir -p "$tmp"
|
|
cd "$tmp"
|
|
|
|
base_url="https://github.com/libimobiledevice"
|
|
|
|
libs=( "libplist" "libtatsu" "libimobiledevice-glue" "libusbmuxd" "libimobiledevice" "libirecovery" )
|
|
|
|
for name in "${libs[@]}"; do
|
|
ver_var=$(echo "${name^^}_VER" | sed 's/-/_/g')
|
|
ver="${!ver_var:-}"
|
|
if [ -z "$ver" ]; then
|
|
echo "Version for $name not set (env var $ver_var)"
|
|
exit 1
|
|
fi
|
|
|
|
archive="${name}-${ver}.tar.bz2"
|
|
url="${base_url}/${name}/releases/download/${ver}/${archive}"
|
|
echo "=== Processing $name $ver ==="
|
|
echo "URL: $url"
|
|
curl --retry 3 --retry-delay 5 -L -o "$archive" "$url"
|
|
|
|
echo "Extracting $archive"
|
|
tar xjf "$archive"
|
|
|
|
srcdir="${name}-${ver}"
|
|
pushd "$srcdir"
|
|
|
|
./configure --without-cython
|
|
make -j"$(nproc)"
|
|
make install
|
|
popd
|
|
echo "Installed $name $ver"
|
|
done
|
|
|
|
# cleanup
|
|
cd "$workspace"
|
|
rm -rf "$tmp"
|
|
|
|
- name: Configure CMake
|
|
run: |
|
|
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="$Qt6_DIR" -DDEPLOY=OFF
|
|
|
|
- name: Build with CMake
|
|
run: cmake --build build --config Release
|
|
|
|
- name: Install & CPack
|
|
id: cpack_step # Add an ID to this step
|
|
working-directory: build
|
|
shell: pwsh
|
|
run: |
|
|
cmake --install .
|
|
cpack .
|
|
# Find the generated files and set them as outputs
|
|
$msiFile = Get-ChildItem -Path "artifacts/*.msi" | Select-Object -First 1
|
|
$zipFile = Get-ChildItem -Path "artifacts/*.zip" | Select-Object -First 1
|
|
|
|
$newZipName = $zipFile.Name.Replace(".zip", ".portable.zip")
|
|
Rename-Item -Path $zipFile.FullName -NewName $newZipName
|
|
$zipFile = Get-ChildItem -Path "artifacts/*.portable.zip" | Select-Object -First 1
|
|
|
|
echo "msi_name=$($msiFile.Name)" >> $env:GITHUB_OUTPUT
|
|
echo "msi_path=$($msiFile.FullName)" >> $env:GITHUB_OUTPUT
|
|
echo "zip_name=$($zipFile.Name)" >> $env:GITHUB_OUTPUT
|
|
echo "zip_path=$($zipFile.FullName)" >> $env:GITHUB_OUTPUT
|
|
|
|
- name: Upload Installer Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.cpack_step.outputs.msi_name }}
|
|
path: ${{ steps.cpack_step.outputs.msi_path }}
|
|
|
|
- name: Upload Portable ZIP Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ steps.cpack_step.outputs.zip_name }}
|
|
path: ${{ steps.cpack_step.outputs.zip_path }}
|