From cf715ea38fb53810a69898c0907a171f2a052294 Mon Sep 17 00:00:00 2001 From: Kevin Yue Date: Sat, 14 Nov 2026 23:38:03 +0800 Subject: [PATCH] fix: repair platform dependency and Windows CI inputs --- .github/workflows/build-windows.yaml | 23 +++++++++------------ .github/workflows/publish-update-feeds.yaml | 11 ++++++---- Cargo.lock | 11 ++++++++++ apps/gpservice/Cargo.toml | 6 ++++++ scripts/build-openconnect-windows.ps1 | 5 +++-- scripts/build-openconnect-windows.sh | 5 +++-- scripts/test-openconnect-windows.ps1 | 5 +++-- scripts/test-openconnect-windows.sh | 3 ++- 8 files changed, 45 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build-windows.yaml b/.github/workflows/build-windows.yaml index 09d9bf8..edb30ae 100644 --- a/.github/workflows/build-windows.yaml +++ b/.github/workflows/build-windows.yaml @@ -59,13 +59,13 @@ jobs: - uses: msys2/setup-msys2@v2 id: msys2 with: - msystem: MINGW64 + msystem: UCRT64 update: true install: >- base-devel autoconf automake libtool gettext git - mingw-w64-x86_64-gcc mingw-w64-x86_64-pkgconf - mingw-w64-x86_64-gnutls mingw-w64-x86_64-libxml2 - mingw-w64-x86_64-lz4 + mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-pkgconf + mingw-w64-ucrt-x86_64-gnutls mingw-w64-ucrt-x86_64-libxml2 + mingw-w64-ucrt-x86_64-lz4 - name: Prepare pinned installer and driver inputs shell: pwsh run: | @@ -73,11 +73,8 @@ jobs: if (!$env:GPGUI_WINDOWS_UPDATE_PUBLIC_KEY -or !$env:GPGUI_LICENSE_SIGNING_KEYS) { throw 'Configure the Windows update and licensing public keys.' } $tools = Join-Path $env:RUNNER_TEMP 'windows-tools' New-Item -ItemType Directory -Force $tools | Out-Null - $nsis = Join-Path $tools 'nsis.zip' - Invoke-WebRequest 'https://downloads.sourceforge.net/project/nsis/NSIS%203/3.12/nsis-3.12.zip' -OutFile $nsis - if ((Get-FileHash $nsis).Hash -ne '56581F90DB321581C5381193D796FFFCF2D24B2F8FED2160A6C6A3BAA67F2C4F') { throw 'NSIS checksum mismatch.' } - Expand-Archive $nsis $tools - Remove-Item $nsis + choco install nsis --version=3.12.0 --yes --no-progress + if ($LASTEXITCODE -ne 0) { throw 'Installing NSIS 3.12 failed.' } $wintun = Join-Path $tools 'wintun.zip' Invoke-WebRequest 'https://www.wintun.net/builds/wintun-0.14.1.zip' -OutFile $wintun if ((Get-FileHash $wintun).Hash -ne '07C256185D6EE3652E09FA55C0B673E2624B565E02C4B9091C79CA7D2F24EF51') { throw 'Wintun checksum mismatch.' } @@ -91,8 +88,8 @@ jobs: run: | $ErrorActionPreference = 'Stop' $prefix = Join-Path $env:RUNNER_TEMP 'native-windows' - & ./source/gp/scripts/build-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -Prefix $prefix - & ./source/gp/scripts/test-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -Prefix $prefix + & ./source/gp/scripts/build-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -MsysSubsystem ucrt64 -Prefix $prefix + & ./source/gp/scripts/test-openconnect-windows.ps1 -MsysRoot $env:MSYS_ROOT -MsysSubsystem ucrt64 -Prefix $prefix "OPENCONNECT_WINDOWS_PREFIX=$prefix" >> $env:GITHUB_ENV - name: Build and package the matching Windows runtime shell: pwsh @@ -104,9 +101,9 @@ jobs: # Compiler diagnostics may contain private GUI source. Keep them on the runner. try { & ./source/gpgui/scripts/build-windows.ps1 -Profile Release ` - -NativePrefix $env:OPENCONNECT_WINDOWS_PREFIX -MsysRoot $env:MSYS_ROOT ` + -NativePrefix $env:OPENCONNECT_WINDOWS_PREFIX -MsysRoot $env:MSYS_ROOT -MsysSubsystem ucrt64 ` -WintunDirectory (Join-Path $env:WINDOWS_BUILD_TOOLS 'wintun') ` - -MakeNsis (Join-Path $env:WINDOWS_BUILD_TOOLS 'nsis-3.12/Bin/makensis.exe') ` + -MakeNsis (Join-Path ${env:ProgramFiles(x86)} 'NSIS/makensis.exe') ` -OutputDirectory "$env:GITHUB_WORKSPACE/artifacts" *> $log } catch { throw 'Windows compilation or packaging failed; private diagnostics remain on the runner.' } Write-Host 'Windows compilation and packaging passed.' diff --git a/.github/workflows/publish-update-feeds.yaml b/.github/workflows/publish-update-feeds.yaml index baac2de..bdda15d 100644 --- a/.github/workflows/publish-update-feeds.yaml +++ b/.github/workflows/publish-update-feeds.yaml @@ -528,15 +528,18 @@ jobs: --channel "$CHANNEL" \ --archive-url "https://github.com/$REPOSITORY/releases/download/$RELEASE_TAG/$ARCHIVE_NAME" - - name: Deploy update feed worker - env: - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + - name: Preserve other platform feeds run: | python3 scripts/preserve-update-feeds.py \ --base-url "${FEED_URL%/appcast.xml}" \ --directory gpgui/apps/update-feed-worker/public \ --exclude appcast.xml --exclude latest.json + + - name: Deploy update feed worker + env: + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + run: | trap 'status=$?; if [ "$status" -ne 0 ]; then echo "::error::Private operation failed; diagnostics suppressed."; fi' EXIT ( set -euo pipefail diff --git a/Cargo.lock b/Cargo.lock index e48e730..a490857 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2299,6 +2299,7 @@ dependencies = [ "gptunnel", "gpvpnc", "log", + "mac_address", "nix", "openconnect", "openssl", @@ -3258,6 +3259,16 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3d25b0e0b648a86960ac23b7ad4abb9717601dec6f66c165f5b037f3f03065f" +[[package]] +name = "mac_address" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0581a75c45969c63afd2bb87b1d8b25cfcc556c7a918cf9bb13b0fe8d2381" +dependencies = [ + "nix", + "windows-sys 0.61.2", +] + [[package]] name = "macro-string" version = "0.3.0" diff --git a/apps/gpservice/Cargo.toml b/apps/gpservice/Cargo.toml index fb9acc6..6a9c5db 100644 --- a/apps/gpservice/Cargo.toml +++ b/apps/gpservice/Cargo.toml @@ -34,6 +34,12 @@ getrandom = "0.4" [target.'cfg(unix)'.dependencies] nix = { version = "0.31", features = ["fs", "socket", "user"] } +[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))'.dependencies] +mac_address = "1.2.1" + +[target.'cfg(unix)'.dev-dependencies] +mac_address = "1.2.1" + [dev-dependencies] openssl.workspace = true tokio-tungstenite.workspace = true diff --git a/scripts/build-openconnect-windows.ps1 b/scripts/build-openconnect-windows.ps1 index 78d9714..d9e531e 100644 --- a/scripts/build-openconnect-windows.ps1 +++ b/scripts/build-openconnect-windows.ps1 @@ -3,6 +3,7 @@ [CmdletBinding()] param( [string]$MsysRoot = 'C:\msys64', + [ValidateSet('mingw64','ucrt64')][string]$MsysSubsystem = 'mingw64', [string]$Prefix, [int]$Jobs = 4 ) @@ -13,7 +14,7 @@ $Prefix = [System.IO.Path]::GetFullPath($Prefix) $bash = Join-Path $MsysRoot 'usr\bin\bash.exe' if (!(Test-Path $bash)) { throw 'MSYS2 is required to build OpenConnect.' } $ErrorActionPreference = 'Continue' -& $bash "$PSScriptRoot/build-openconnect-windows.sh" $repo $Prefix $Jobs +& $bash "$PSScriptRoot/build-openconnect-windows.sh" $repo $Prefix $Jobs $MsysSubsystem $nativeExit = $LASTEXITCODE $ErrorActionPreference = 'Stop' if ($nativeExit -ne 0) { throw 'OpenConnect compilation failed.' } @@ -49,7 +50,7 @@ while ($pending.Count) { foreach ($line in $dependencies) { if ($line -notmatch '^\s+(\S+\.dll)\s*$') { continue } $name = $Matches[1] - $source = Join-Path "$MsysRoot\mingw64\bin" $name + $source = Join-Path "$MsysRoot\$MsysSubsystem\bin" $name if (Test-Path $source) { $target = Join-Path "$Prefix\bin" $name Copy-Item $source $target -Force diff --git a/scripts/build-openconnect-windows.sh b/scripts/build-openconnect-windows.sh index a8aa539..0028e05 100644 --- a/scripts/build-openconnect-windows.sh +++ b/scripts/build-openconnect-windows.sh @@ -1,11 +1,12 @@ #!/usr/bin/env bash # Build the bundled protocol library with MSYS2's native Windows compiler. set -euo pipefail -export PATH="/mingw64/bin:/usr/bin:$PATH" +subsystem=$4 +export PATH="/$subsystem/bin:/usr/bin:$PATH" repo=$(cygpath -u "$1") prefix=$(cygpath -u "$2") jobs=$3 -export ACLOCAL_PATH=/mingw64/share/aclocal +export ACLOCAL_PATH="/$subsystem/share/aclocal" source_dir="$repo/crates/openconnect/deps/openconnect" build_dir="$repo/target/openconnect-windows" cd "$source_dir" diff --git a/scripts/test-openconnect-windows.ps1 b/scripts/test-openconnect-windows.ps1 index f94c5ac..15fae33 100644 --- a/scripts/test-openconnect-windows.ps1 +++ b/scripts/test-openconnect-windows.ps1 @@ -1,6 +1,7 @@ [CmdletBinding()] -param([string]$MsysRoot = 'C:\msys64', [string]$Prefix = $env:OPENCONNECT_WINDOWS_PREFIX) +param([string]$MsysRoot = 'C:\msys64', [string]$Prefix = $env:OPENCONNECT_WINDOWS_PREFIX, + [ValidateSet('mingw64','ucrt64')][string]$MsysSubsystem = 'mingw64') $repo = Split-Path $PSScriptRoot -Parent if (!$Prefix) { $Prefix = Join-Path $repo 'target\native-windows' } -& "$MsysRoot\usr\bin\bash.exe" "$PSScriptRoot/test-openconnect-windows.sh" $repo $Prefix +& "$MsysRoot\usr\bin\bash.exe" "$PSScriptRoot/test-openconnect-windows.sh" $repo $Prefix $MsysSubsystem if ($LASTEXITCODE -ne 0) { throw 'Native OpenConnect packet-pipe tests failed.' } diff --git a/scripts/test-openconnect-windows.sh b/scripts/test-openconnect-windows.sh index 752d128..4c628c9 100644 --- a/scripts/test-openconnect-windows.sh +++ b/scripts/test-openconnect-windows.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # Run the native packet-pipe regression against the bundled Windows DLL. set -euo pipefail -export PATH="/mingw64/bin:/usr/bin:$PATH" +subsystem=$3 +export PATH="/$subsystem/bin:/usr/bin:$PATH" repo=$(cygpath -u "$1") prefix=$(cygpath -u "$2") build_dir="$repo/target/openconnect-windows"