This commit is contained in:
test123456654321 2024-11-02 15:26:54 +08:00 committed by GitHub
parent 245259e0cc
commit a900de60ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 108 additions and 120 deletions

View File

@ -4,60 +4,51 @@ on:
workflow_dispatch:
jobs:
loadversion:
runs-on: windows-latest
outputs:
version: ${{ steps.loadversion.outputs.version }}
steps:
- uses: actions/checkout@v4
- id: loadversion
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
build_xp:
runs-on: windows-2019
needs: loadversion
strategy:
matrix:
include:
- target: Release_English_winxp
- target: Release_Chinese_winxp
- target: Release_Russian_winxp
- target: Release_TradChinese_winxp
language: [Chinese,English,Russian,TradChinese]
permissions:
id-token: write
attestations: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
- uses: actions/checkout@v4
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- name: Install Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: x64
- run: python build.py build ${{ matrix.language }} winxp
- name: Run build script
run: python build.py ${{ matrix.target }}
- name: Pack
run: python build.py pack
- run: python scripts/pack.py
# - name: Generate attestation for artifact
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: builds/${{ matrix.target }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: builds/${{ matrix.target }}.zip
- name: loadversion
id: loadversion
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Release LunaHook
uses: softprops/action-gh-release@v2
name: ${{ matrix.language }}_winxp
path: builds/Release_${{ matrix.language }}_winxp.zip
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.loadversion.outputs.version }}
files: builds/${{ matrix.target }}.zip
tag_name: ${{ needs.loadversion.outputs.version }}
files: builds/Release_${{ matrix.language }}_winxp.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_plugin:
runs-on: windows-latest
needs: [loadversion]
strategy:
matrix:
include:
@ -72,15 +63,12 @@ jobs:
attestations: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
- uses: actions/checkout@v4
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
- uses: jurplel/install-qt-action@v3.3.0
with:
version: 5.15.2
host: windows
@ -88,79 +76,58 @@ jobs:
arch: ${{ matrix.qtarch }}
dir: ${{ runner.temp }}
setup-python: true
- name: Run build script
run: python build.py ${{ matrix.cmd }}
- run: python build.py ${{ matrix.cmd }}
- name: Pack
run: python build.py pack
- run: python scripts/pack.py
# - name: Generate attestation for artifact
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: builds/${{ matrix.target }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: builds/${{ matrix.target }}.zip
- name: loadversion
id: loadversion
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Release LunaHook
uses: softprops/action-gh-release@v2
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.loadversion.outputs.version }}
tag_name: ${{ needs.loadversion.outputs.version }}
files: builds/${{ matrix.target }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build_everylang:
build:
runs-on: windows-latest
strategy:
matrix:
include:
- target: Release_English
- target: Release_Chinese
- target: Release_Russian
- target: Release_TradChinese
language: [Chinese,English,Russian,TradChinese]
bits: [32, 64]
permissions:
id-token: write
attestations: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Windows 10 SDK
uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
- uses: actions/checkout@v4
- uses: GuillaumeFalourd/setup-windows10-sdk-action@v2
with:
sdk-version: 22621
- name: Install Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
architecture: x64
- name: Run build script
run: python build.py ${{ matrix.target }}
- run: python build.py build ${{ matrix.language }} ${{matrix.bits}}
- name: Pack
run: python build.py pack
# - name: Generate attestation for artifact
# uses: actions/attest-build-provenance@v1
# with:
# subject-path: builds/${{ matrix.target }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: builds/${{ matrix.target }}.zip
- name: loadversion
id: loadversion
run: python build.py loadversion | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Release LunaHook
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.loadversion.outputs.version }}
files: builds/${{ matrix.target }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: ${{ matrix.language }}_${{matrix.bits}}
path: builds
release:
runs-on: windows-latest
needs: [build, loadversion]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: build
- run: python build.py merge
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.loadversion.outputs.version }}
files: builds/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -1,7 +1,9 @@
import os, sys, re
import os, sys, re, shutil
import subprocess
rootDir = os.path.dirname(__file__)
if not rootDir:
rootDir = os.path.abspath(".")
if len(sys.argv) and sys.argv[1] == "loadversion":
os.chdir(rootDir)
with open("CMakeLists.txt", "r", encoding="utf8") as ff:
@ -11,10 +13,34 @@ if len(sys.argv) and sys.argv[1] == "loadversion":
versionstring = f"v{version_major}.{version_minor}.{version_patch}"
print("version=" + versionstring)
exit()
if len(sys.argv) and sys.argv[1] == "merge":
os.mkdir("../build")
os.mkdir("builds")
language = ["Chinese", "English", "Russian", "TradChinese"]
bits = [32, 64]
for lang in language:
for bit in bits:
shutil.copytree(
f"build/{lang}_{bit}/Release_{lang}",
f"../build/Release_{lang}",
dirs_exist_ok=True,
)
targetdir = f"../build/Release_{lang}"
target = f"builds/Release_{lang}.zip"
os.system(
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
)
exit()
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"
print(sys.version)
print(__file__)
print(rootDir)
def installVCLTL():
os.chdir(rootDir)
if os.path.exists("temp"):
@ -25,18 +51,22 @@ def installVCLTL():
subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd")
def build_langx(lang):
def build_langx(lang, bit):
with open("do.bat", "w") as ff:
ff.write(
rf"""
if bit == "32":
ff.write(
rf"""
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_{lang}
cmake --build ../build/x86_{lang} --config Release --target ALL_BUILD -j 14
"""
)
elif bit == "64":
ff.write(
rf"""
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64_{lang}
cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14
"""
)
)
os.system(f"cmd /c do.bat")
@ -53,29 +83,16 @@ call dobuildxp.bat
os.system(f"cmd /c do.bat")
if sys.argv[1] == "pack":
os.chdir(os.path.join(rootDir, "scripts"))
os.system(f"python pack.py pack")
else:
installVCLTL()
os.chdir(os.path.join(rootDir, "scripts"))
if sys.argv[1] == "plg32":
os.system(f"cmd /c buildplugin32.bat")
elif sys.argv[1] == "plg64":
os.system(f"cmd /c buildplugin64.bat")
elif sys.argv[1] == "Release_English":
build_langx("English")
elif sys.argv[1] == "Release_Chinese":
build_langx("Chinese")
elif sys.argv[1] == "Release_Russian":
build_langx("Russian")
elif sys.argv[1] == "Release_TradChinese":
build_langx("TradChinese")
elif sys.argv[1] == "Release_English_winxp":
build_langx_xp("English")
elif sys.argv[1] == "Release_Chinese_winxp":
build_langx_xp("Chinese")
elif sys.argv[1] == "Release_Russian_winxp":
build_langx_xp("Russian")
elif sys.argv[1] == "Release_TradChinese_winxp":
build_langx_xp("TradChinese")
installVCLTL()
os.chdir(os.path.join(rootDir, "scripts"))
if sys.argv[1] == "plg32":
os.system(f"cmd /c buildplugin32.bat")
elif sys.argv[1] == "plg64":
os.system(f"cmd /c buildplugin64.bat")
elif sys.argv[1] == "build":
lang = sys.argv[2]
bit = sys.argv[3]
if bit == "winxp":
build_langx_xp(lang)
else:
build_langx(lang, bit)

View File

@ -1,5 +1,7 @@
import os, shutil, sys
os.chdir(os.path.dirname(__file__))
for f in os.listdir("../builds"):
if os.path.isdir("../builds/" + f) == False:
@ -27,4 +29,6 @@ for f in os.listdir("../builds"):
os.remove(path)
targetdir = "../builds/" + f
target = "../builds/" + f + ".zip"
os.system(rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}')
os.system(
rf'"C:\Program Files\7-Zip\7z.exe" a -m0=Deflate -mx9 {target} {targetdir}'
)