1+ name : windows build workflows
2+
3+ on :
4+ push :
5+ branches :
6+ - ' master'
7+
8+ jobs :
9+ build :
10+ strategy :
11+ fail-fast : false
12+ matrix :
13+ configuration : [Debug ,Release]
14+ platform : [x86 ,x64]
15+
16+ runs-on : windows-latest # 最新的 Windows 环境
17+
18+ steps :
19+ # 检出您的主仓库代码
20+ - name : Checkout main repository code
21+ uses : actions/checkout@v4
22+
23+ # 检出依赖的xengine仓库到指定的xengine目录
24+ - name : Checkout dependency repository (xengine)
25+ uses : actions/checkout@v4
26+ with :
27+ repository : libxengine/libxengine
28+ path : libxengine
29+
30+ - name : vcpkg dependency repository
31+ uses : actions/checkout@v4
32+ with :
33+ repository : microsoft/vcpkg
34+ path : vcpkg
35+
36+ - name : vcpkg install (x86)
37+ if : matrix.platform == 'x86'
38+ run : |
39+ cd vcpkg
40+ ./bootstrap-vcpkg.bat
41+ ./vcpkg.exe install lua:x86-windows sdl2:x86-windows
42+ ./vcpkg.exe integrate install
43+ shell : pwsh
44+ - name : vcpkg install (x64)
45+ if : matrix.platform == 'x64'
46+ run : |
47+ cd vcpkg
48+ ./bootstrap-vcpkg.bat
49+ ./vcpkg.exe install lua:x86-windows sdl2:x64-windows
50+ ./vcpkg.exe integrate install
51+ shell : pwsh
52+
53+ - name : Set up Dependency x86_64 Environment
54+ if : matrix.platform == 'x64'
55+ run : |
56+ echo "XENGINE_INCLUDE=${{ github.workspace }}/libxengine" | Out-File -FilePath $env:GITHUB_ENV -Append
57+ echo "XENGINE_LIB64=${{ github.workspace }}/libxengine/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
58+ shell : pwsh
59+ - name : Set up Dependency x86_32 Environment
60+ if : matrix.platform == 'x86'
61+ run : |
62+ $response = Invoke-RestMethod -Uri "https://api.github.com/repos/libxengine/libxengine/releases/latest" -Headers @{"Accept"="application/vnd.github.v3+json"}
63+ $latest_tag = $response.tag_name
64+ Write-Host "Latest Tag: $latest_tag"
65+
66+ $url = "https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Windows_x86-32.zip"
67+ Invoke-WebRequest -Uri $url -OutFile "XEngine_Windows_x86-32.zip"
68+ Expand-Archive -Path ./XEngine_Windows_x86-32.zip -DestinationPath ./XEngine_Windows -Force
69+
70+ echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
71+ echo "XENGINE_LIB32=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
72+ shell : pwsh
73+
74+ - name : Setup MSBuild
75+ uses : microsoft/setup-msbuild@v2
76+
77+ - name : Build Solution
78+ run : msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }}
0 commit comments