ci: add legacy windows build

This commit is contained in:
parhelia512 2025-07-17 09:06:38 +08:00
parent af1b0c05b5
commit c80eb7118e
4 changed files with 94 additions and 12 deletions

View File

@ -33,6 +33,12 @@ jobs:
- cross_os: darwin
cross_arch: arm64
go_version: "1.24.4"
- cross_os: windowslegacy
cross_arch: amd64
go_version: "1.24.4"
- cross_os: windowslegacy
cross_arch: 386
go_version: "1.24.4"
fail-fast: false
runs-on: ubuntu-latest
steps:
@ -52,9 +58,16 @@ jobs:
cache-dependency-path: |
core/server/go.sum
core/updater/go.sum
- name: Install Golang For Legacy Windows
if: matrix.cross_os == 'windowslegacy'
run: |
curl -L -o go.7z https://github.com/throneproj/env_windows_legacy/releases/download/latest/go.7z
7z x go.7z
- name: Install Protoc
if: matrix.cross_os != 'public_res'
uses: arduino/setup-protoc@v3
- name: Installing protoc-gen-go
if: matrix.cross_os != 'public_res'
run: |
go install github.com/golang/protobuf/protoc-gen-go@latest
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
@ -83,7 +96,11 @@ jobs:
include:
- platform: windows-latest
qt_version: "6.9.0"
<<<<<<< HEAD
target: amd64
=======
target: x86_64
>>>>>>> origin/windows-legacy
- platform: ubuntu-22.04
qt_version: "6.9.0"
target: amd64
@ -96,6 +113,12 @@ jobs:
- platform: macos-latest
qt_version: "6.9.0"
target: arm64
- platform: windows-latest
qt_version: "6.2.12"
target: x86_64
- platform: windows-latest
qt_version: "6.2.12"
target: i686
fail-fast: false
runs-on: ${{ matrix.platform }}
env:
@ -109,6 +132,8 @@ jobs:
- name: Install mingw
if: matrix.platform == 'windows-latest'
uses: bwoodsend/setup-winlibs-action@v1.15
with:
architecture: ${{ matrix.target }}
- name: Download Artifacts
uses: actions/download-artifact@v4.3.0
with:
@ -116,14 +141,14 @@ jobs:
# ========================================================================================================= Qt Install
- name: Qt static Cache
id: cache-static-Qt
if: matrix.platform == 'windows-latest'
if: matrix.platform == 'windows-latest' && matrix.qt_version != '6.2.12'
uses: actions/cache@v4.2.3
with:
path: qt6/build
key: QtStaticCache-${{ matrix.platform }}-${{ matrix.target }}-Qt${{ matrix.qt_version }}
- name: Install Qt Windows
shell: powershell
if: matrix.platform == 'windows-latest' && steps.cache-static-Qt.outputs.cache-hit != 'true'
if: matrix.platform == 'windows-latest' && steps.cache-static-Qt.outputs.cache-hit != 'true' && matrix.qt_version != '6.2.12'
run: ./script/build_qt_static_windows.bat ${{ matrix.qt_version }}
- name: Install Qt
uses: jurplel/install-qt-action@v4.3.0
@ -136,7 +161,7 @@ jobs:
# ========================================================================================================= Generate MakeFile and Build
- name: Windows - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'windows-latest'
if: matrix.platform == 'windows-latest' && matrix.qt_version != '6.2.12'
run: |
export CMAKE_PREFIX_PATH=$PWD/qt6/build/lib/cmake
mkdir build
@ -144,10 +169,26 @@ jobs:
cmake -GNinja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_BUILD_TYPE=Debug ..
ninja -j2
cd ..
./script/deploy_windows64.sh
./script/deploy_windows.sh
- name: Legacy Windows - Generate MakeFile and Build
shell: bash
if: matrix.platform == 'windows-latest' && matrix.qt_version == '6.2.12'
run: |
curl -L -o qt.7z https://github.com/throneproj/env_windows_legacy/releases/download/latest/qt-${{ matrix.target }}.7z
7z x qt.7z
curl -L -o openssl.7z https://github.com/throneproj/env_windows_legacy/releases/download/latest/openssl-${{ matrix.target }}.7z
7z x openssl.7z
export CMAKE_PREFIX_PATH=$PWD/Qt/lib/cmake
export OPENSSL_ROOT_DIR=$PWD/openssl
mkdir build
cd build
cmake -GNinja -DCMAKE_CXX_FLAGS="-static" -DCMAKE_BUILD_TYPE=Debug ..
ninja -j2
cd ..
./script/deploy_windows.sh ${{ matrix.target }}
- name: Build Installer with NSIS
shell: cmd
if: matrix.platform == 'windows-latest'
if: matrix.platform == 'windows-latest' && matrix.qt_version != '6.2.12'
run: |
cp .\script\windows_installer.nsi .
makensis windows_installer.nsi
@ -225,6 +266,14 @@ jobs:
zip -9 -r $version_standalone-windows64.zip Throne
rm -rf Throne
####
mv windows32 Throne
zip -9 -r $version_standalone-windows32.zip Throne
rm -rf Throne
####
mv windowslegacy64 Throne
zip -9 -r $version_standalone-windowslegacy64.zip Throne
rm -rf Throne
####
mkdir Throne
mv macos-arm64/Throne.app Throne/Throne.app
zip -9 --symlinks -r $version_standalone-macos-arm64.zip Throne
@ -243,6 +292,8 @@ jobs:
rm -rf linux-arm64
rm -rf linux-amd64
rm -rf windows64
rm -rf windows32
rm -rf windowslegacy64
rm -rf macos-amd64
rm -rf macos-arm64
rm -rf public_res

View File

@ -3,12 +3,25 @@ set -e
source script/env_deploy.sh
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/windows64 || true
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "386" ] && DEST=$DEPLOYMENT/windows32 || true
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/windows-arm64 || true
[ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/linux-amd64 || true
[ "$GOOS" == "linux" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/linux-arm64 || true
[ "$GOOS" == "darwin" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/macos-amd64 || true
[ "$GOOS" == "darwin" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/macos-arm64 || true
if [[ "$GOOS" == "windowslegacy" ]]; then
GOOS="windows"
GOCMD="$PWD/go/bin/go"
if [[ $GOARCH == 'amd64' ]]; then
DEST=$DEPLOYMENT/windowslegacy64
else
DEST=$DEPLOYMENT/windows32
fi
else
GOCMD="go"
fi
if [ -z $DEST ]; then
echo "Please set GOOS GOARCH"
exit 1
@ -20,7 +33,7 @@ export CGO_ENABLED=0
#### Go: updater ####
pushd core/updater
[ "$GOOS" == "darwin" ] || go build -o $DEST -trimpath -ldflags "-w -s"
[ "$GOOS" == "darwin" ] || $GOCMD build -o $DEST -trimpath -ldflags "-w -s"
popd
#### Go: core ####
@ -29,5 +42,5 @@ pushd gen
protoc -I . --go_out=. --go_opt paths=source_relative --go-grpc_out=. --go-grpc_opt paths=source_relative libcore.proto
popd
VERSION_SINGBOX=$(go list -m -f '{{.Version}}' github.com/sagernet/sing-box)
go build -v -o $DEST -trimpath -ldflags "-w -s -X 'github.com/sagernet/sing-box/constant.Version=${VERSION_SINGBOX}'" -tags "with_clash_api,with_gvisor,with_quic,with_wireguard,with_utls,with_ech,with_dhcp"
$GOCMD build -v -o $DEST -trimpath -ldflags "-w -s -X 'github.com/sagernet/sing-box/constant.Version=${VERSION_SINGBOX}'" -tags "with_clash_api,with_gvisor,with_quic,with_wireguard,with_utls,with_ech,with_dhcp"
popd

View File

@ -2,7 +2,18 @@
set -e
source script/env_deploy.sh
DEST=$DEPLOYMENT/windows64
if [[ $1 == 'i686' ]]; then
ARCH="windowslegacy-386"
DEST=$DEPLOYMENT/windows32
else
if [[ $1 == 'x86_64' ]]; then
ARCH="windowslegacy-amd64"
DEST=$DEPLOYMENT/windowslegacy64
else
ARCH="windows-amd64"
DEST=$DEPLOYMENT/windows64
fi
fi
rm -rf $DEST
mkdir -p $DEST
@ -21,7 +32,7 @@ mv Throne.pdb $DEST
cp $BUILD/Throne.exe $DEST
cd download-artifact
cd *windows-amd64
cd *$ARCH
tar xvzf artifacts.tgz -C ../../
cd ..
cd *public_res

View File

@ -22,6 +22,10 @@
#ifdef Q_OS_WIN
#include "3rdparty/WinCommander.hpp"
#include <sdkddkver.h>
#include <minwindef.h>
#include <winbase.h>
#include <VersionHelpers.h>
#else
#ifdef Q_OS_LINUX
#include "include/sys/linux/LinuxCap.h"
@ -2280,16 +2284,19 @@ void MainWindow::CheckUpdate() {
QString search;
#ifdef Q_OS_WIN32
# ifdef Q_OS_WIN64
search = "windows64";
if (IsWindows10OrGreater())
search = "windows64";
else
search = "windowslegacy64";
# else
search = "windows32";
# endif
#endif
#ifdef Q_OS_LINUX
# ifdef Q_PROCESSOR_X86_64
search = "linux-amd64";
search = "linux-amd64";
# else
search = "linux-arm64";
search = "linux-arm64";
# endif
#endif
#ifdef Q_OS_MACOS