actions: fix, add 32xp support

This commit is contained in:
Ayase 2024-04-26 16:45:45 +08:00
parent 1645418029
commit 09d06b3a36
No known key found for this signature in database
GPG Key ID: A41823C23177547B
4 changed files with 162 additions and 33 deletions

View File

@ -11,6 +11,45 @@ on:
env: env:
QT_VERSION: 5.15.2 QT_VERSION: 5.15.2
jobs: jobs:
build_xp:
runs-on: windows-2019
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- name: Install Qt32
uses: jurplel/install-qt-action@v3.3.0
with:
version: ${{ env.QT_VERSION }}
host: windows
target: desktop
arch: win32_msvc2019
dir: ${{ runner.temp }}
setup-python: true
- name: Run build script 32xp
run: python build.py 32xp
- name: Pack
run: python build.py pack_xp
# - name: Upload plugin32_xp artifact
# uses: actions/upload-artifact@v4
# with:
# name: plugin32_xp
# path: builds/plugin32_xp.zip
- name: Upload English xp artifact
uses: actions/upload-artifact@v4
with:
name: Release_English_xp
path: builds/Release_English_xp.zip
- name: Upload Chinese xp artifact
uses: actions/upload-artifact@v4
with:
name: Release_Chinese_xp
path: builds/Release_Chinese_xp.zip
build: build:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
@ -44,9 +83,71 @@ jobs:
setup-python: true setup-python: true
- name: Run build script - name: Run build script
run: python build.py 64 run: python build.py 64
- name: Pack - name: Pack
run: python build.py 0 run: python build.py pack
- name: Release LunaTranslator - name: Upload plugin32 artifact
uses: actions/upload-artifact@v4
with:
name: plugin32
path: builds/plugin32.zip
- name: Upload plugin64 artifact
uses: actions/upload-artifact@v4
with:
name: plugin64
path: builds/plugin64.zip
- name: Upload English artifact
uses: actions/upload-artifact@v4
with:
name: Release_English
path: builds/Release_English.zip
- name: Upload Chinese artifact
uses: actions/upload-artifact@v4
with:
name: Release_Chinese
path: builds/Release_Chinese.zip
release:
needs: [build, build_xp]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download plugin32 artifact
uses: actions/download-artifact@v4
with:
name: plugin32
path: builds
- name: Download plugin64 artifact
uses: actions/download-artifact@v4
with:
name: plugin64
path: builds
- name: Download English artifact
uses: actions/download-artifact@v4
with:
name: Release_English
path: builds
- name: Download Chinese artifact
uses: actions/download-artifact@v4
with:
name: Release_Chinese
path: builds
# - name: Download plugin32_xp artifact
# uses: actions/download-artifact@v4
# with:
# name: plugin32_xp
# path: builds
- name: Download English xp artifact
uses: actions/download-artifact@v4
with:
name: Release_English_xp
path: builds
- name: Download Chinese xp artifact
uses: actions/download-artifact@v4
with:
name: Release_Chinese_xp
path: builds
- name: Release LunaHook
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: ${{ github.event.inputs.create_release }} tag_name: ${{ github.event.inputs.create_release }}

View File

@ -1,25 +1,31 @@
import os, sys
import os,sys
import shutil
import subprocess import subprocess
rootDir = os.path.dirname(__file__) rootDir = os.path.dirname(__file__)
vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z" vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z"
vcltlFileName = "VC-LTL-5.0.9-Binary.7z" vcltlFileName = "VC-LTL-5.0.9-Binary.7z"
availableTargets = ["32xp", "32", "64"]
def installVCLTL(): def installVCLTL():
os.makedirs(rootDir + "\\temp",exist_ok=True) os.chdir(rootDir)
os.chdir(rootDir + "\\temp") if os.path.exists("temp"):
subprocess.run(f"curl -LO {vcltlFile}") return # already installed
subprocess.run(f"7z x {vcltlFileName} -oVC-LTL5") os.makedirs(rootDir + "\\temp", exist_ok=True)
os.chdir("VC-LTL5") subprocess.run(f"curl -Lo temp\\{vcltlFileName} {vcltlFile}")
subprocess.run("cmd /c Install.cmd") subprocess.run(f"7z x temp\\{vcltlFileName} -otemp\\VC-LTL5")
os.chdir(os.path.join(rootDir,'scripts')) subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd")
if int(sys.argv[1])==32:
target = sys.argv[1]
os.chdir(os.path.join(rootDir, "scripts"))
if target in availableTargets:
installVCLTL() installVCLTL()
os.system('cmd /c build32.bat') os.chdir(os.path.join(rootDir, "scripts"))
elif int(sys.argv[1])==64: os.system(f"cmd /c build{target}.bat")
installVCLTL()
os.system('cmd /c build64.bat')
else: else:
os.system('cmd /c pack.bat') if target == "pack":
os.system(f"python pack.py pack")
else:
os.system(f"python pack.py pack_xp")

View File

@ -1,8 +1,8 @@
@REM cmake ../CMakeLists.txt -G "Visual Studio 15 2017" -A win32 -T v141_xp -B ../build/xp cmake ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_xp
@REM cmake --build ../build/xp --config Release --target ALL_BUILD -j 14 cmake --build ../build/x86_xp --config Release --target ALL_BUILD -j 14
cmake -DWINXP=1 ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_xp cmake -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 16 2019" -A win32 -T v141_xp -B ../build/x86_zh_xp
cmake -DWINXP=1 -DLANGUAGE=Chinese ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_zh_xp cmake --build ../build/x86_zh_xp --config Release --target ALL_BUILD -j 14
python edit_target.py python edit_target.py
@echo off @echo off

View File

@ -1,14 +1,36 @@
import os, shutil import os, shutil, sys
for f in os.listdir('../builds'):
if os.path.isdir('../builds/'+f)==False:continue
isXp = ""
for dirname,_,fs in os.walk('../builds/'+f): if sys.argv[1] == "pack_xp":
if dirname.endswith('translations') or dirname.endswith('translations') or dirname.endswith('imageformats') or dirname.endswith('iconengines') or dirname.endswith('bearer'): isXp = "_xp"
else:
pass
for f in os.listdir("../builds"):
if os.path.isdir("../builds/" + f) == False:
continue
for dirname, _, fs in os.walk("../builds/" + f):
if (
dirname.endswith("translations")
or dirname.endswith("translations")
or dirname.endswith("imageformats")
or dirname.endswith("iconengines")
or dirname.endswith("bearer")
):
shutil.rmtree(dirname) shutil.rmtree(dirname)
continue continue
for ff in fs: for ff in fs:
path=os.path.join(dirname,ff) path = os.path.join(dirname, ff)
if ff in ['Qt5Svg.dll','libEGL.dll','libGLESv2.dll','opengl32sw.dll','D3Dcompiler_47.dll']:os.remove(path) if ff in [
targetdir='../builds/'+f "Qt5Svg.dll",
target='../builds/'+f+'.zip' "libEGL.dll",
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA -mx9 {target} {targetdir}') "libGLESv2.dll",
"opengl32sw.dll",
"D3Dcompiler_47.dll",
]:
os.remove(path)
targetdir = "../builds/" + f
target = "../builds/" + f + isXp + ".zip"
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=LZMA -mx9 {target} {targetdir}')