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