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

View File

@ -1,7 +1,9 @@
import os, sys, re import os, sys, re, shutil
import subprocess import subprocess
rootDir = os.path.dirname(__file__) rootDir = os.path.dirname(__file__)
if not rootDir:
rootDir = os.path.abspath(".")
if len(sys.argv) and sys.argv[1] == "loadversion": if len(sys.argv) and sys.argv[1] == "loadversion":
os.chdir(rootDir) os.chdir(rootDir)
with open("CMakeLists.txt", "r", encoding="utf8") as ff: 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}" versionstring = f"v{version_major}.{version_minor}.{version_patch}"
print("version=" + versionstring) print("version=" + versionstring)
exit() 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" 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"
print(sys.version)
print(__file__)
print(rootDir)
def installVCLTL(): def installVCLTL():
os.chdir(rootDir) os.chdir(rootDir)
if os.path.exists("temp"): if os.path.exists("temp"):
@ -25,16 +51,20 @@ def installVCLTL():
subprocess.run("cmd /c temp\\VC-LTL5\\Install.cmd") 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: with open("do.bat", "w") as ff:
if bit == "32":
ff.write( ff.write(
rf""" rf"""
cmake -DBUILD_PLUGIN=OFF -DLANGUAGE={lang} ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86_{lang} 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 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 -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 cmake --build ../build/x64_{lang} --config Release --target ALL_BUILD -j 14
""" """
) )
os.system(f"cmd /c do.bat") os.system(f"cmd /c do.bat")
@ -53,29 +83,16 @@ call dobuildxp.bat
os.system(f"cmd /c do.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() installVCLTL()
os.chdir(os.path.join(rootDir, "scripts")) os.chdir(os.path.join(rootDir, "scripts"))
if sys.argv[1] == "plg32": if sys.argv[1] == "plg32":
os.system(f"cmd /c buildplugin32.bat") os.system(f"cmd /c buildplugin32.bat")
elif sys.argv[1] == "plg64": elif sys.argv[1] == "plg64":
os.system(f"cmd /c buildplugin64.bat") os.system(f"cmd /c buildplugin64.bat")
elif sys.argv[1] == "Release_English": elif sys.argv[1] == "build":
build_langx("English") lang = sys.argv[2]
elif sys.argv[1] == "Release_Chinese": bit = sys.argv[3]
build_langx("Chinese") if bit == "winxp":
elif sys.argv[1] == "Release_Russian": build_langx_xp(lang)
build_langx("Russian") else:
elif sys.argv[1] == "Release_TradChinese": build_langx(lang, bit)
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")

View File

@ -1,5 +1,7 @@
import os, shutil, sys import os, shutil, sys
os.chdir(os.path.dirname(__file__))
for f in os.listdir("../builds"): for f in os.listdir("../builds"):
if os.path.isdir("../builds/" + f) == False: if os.path.isdir("../builds/" + f) == False:
@ -27,4 +29,6 @@ for f in os.listdir("../builds"):
os.remove(path) os.remove(path)
targetdir = "../builds/" + f targetdir = "../builds/" + f
target = "../builds/" + f + ".zip" 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}'
)