@@ -3,8 +3,10 @@ name: windows build workflows
33on :
44 push :
55 branches : [ "develop" ]
6- pull_request :
7- branches : [ "develop" ]
6+ paths :
7+ - ' XEngine_Source/**'
8+ - ' XEngine_Release/**'
9+ - ' .github/**'
810
911permissions :
1012 contents : read
1921 platform : [x86 ,x64]
2022
2123 runs-on : windows-latest # 最新的 Windows 环境
22-
24+ env :
25+ ACTIONS_STEP_DEBUG : true
2326 steps :
2427 # 检出您的主仓库代码
2528 - name : Checkout main repository code
@@ -63,22 +66,35 @@ jobs:
6366 ./vcpkg.exe integrate install
6467 shell : pwsh
6568
66- # 设置依赖库的环境变量
67- - name : Set up Dependency Environment Variables
69+ - name : Set up Dependency x86_64 Environment
70+ if : matrix.platform == 'x64'
6871 run : |
6972 echo "XENGINE_INCLUDE=${{ github.workspace }}/libxengine" | Out-File -FilePath $env:GITHUB_ENV -Append
70- echo "XENGINE_LIB32=${{ github.workspace }}/libxengine/XEngine_Windows/x86" | Out-File -FilePath $env:GITHUB_ENV -Append
71- echo "XENGINE_LIB64=${{ github.workspace }}/libxengine/XEngine_Windows/x64" | Out-File -FilePath $env:GITHUB_ENV -Append
73+ echo "XENGINE_LIB64=${{ github.workspace }}/libxengine/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
74+ shell : pwsh
75+ - name : Set up Dependency x86_32 Environment
76+ if : matrix.platform == 'x86'
77+ run : |
78+ $response = Invoke-RestMethod -Uri "https://api.github.com/repos/libxengine/libxengine/releases/latest" -Headers @{"Accept"="application/vnd.github.v3+json"}
79+ $latest_tag = $response.tag_name
80+ Write-Host "Latest Tag: $latest_tag"
81+
82+ $url = "https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Windows_x86-32.zip"
83+ Invoke-WebRequest -Uri $url -OutFile "XEngine_Windows_x86-32.zip"
84+ Expand-Archive -Path ./XEngine_Windows_x86-32.zip -DestinationPath ./XEngine_Windows -Force
85+
86+ echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
87+ echo "XENGINE_LIB32=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append
7288 shell : pwsh
73- - name : Set code page
74- run : chcp 65001
7589
7690 # 配置 MSBuild 的路径,准备构建 VC++ 项目
7791 - name : Setup MSBuild
7892 uses : microsoft/setup-msbuild@v2
93+
7994 # 编译
8095 - name : Build Solution
81- run : msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /p:AdditionalOptions="/utf-8"
96+ run : msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }}
97+
8298 # 测试
8399 - name : Conditional Step for x86 Release
84100 if : matrix.configuration == 'Release' && matrix.platform == 'x86'
@@ -89,14 +105,26 @@ jobs:
89105 cd XEngine_Release
90106 ./VSCopy_x86.bat
91107 ./XEngine_HttpApp.exe -t
92- shell : pwsh
93- - name : Conditional Step for x86 Debug
94- if : matrix.configuration == 'Debug' && matrix.platform == 'x86'
108+ - name : Conditional Step for x64 Release
109+ if : matrix.configuration == 'Release' && matrix.platform == 'x64'
95110 run : |
96- cp -r XEngine_Source/Debug /*.dll XEngine_Release/
97- cp -r XEngine_Source/Debug /*.exe XEngine_Release/
98- cp -r XEngine_Source/VSCopy_x86 .bat XEngine_Release/
111+ cp -r XEngine_Source/x64/Release /*.dll XEngine_Release/
112+ cp -r XEngine_Source/x64/Release /*.exe XEngine_Release/
113+ cp -r XEngine_Source/VSCopy_x64 .bat XEngine_Release/
99114 cd XEngine_Release
100- ./VSCopy_x86.bat
101- ./XEngine_HttpApp.exe -t
115+ ./VSCopy_x64.bat
102116 shell : pwsh
117+
118+ - name : Upload folder as artifact with x86
119+ if : matrix.configuration == 'Release' && matrix.platform == 'x64'
120+ uses : actions/upload-artifact@v4
121+ with :
122+ name : XEngine_APIServiceApp-x86_32-Windows
123+ path : XEngine_Release/
124+
125+ - name : Upload folder as artifact with x64
126+ if : matrix.configuration == 'Release' && matrix.platform == 'x64'
127+ uses : actions/upload-artifact@v4
128+ with :
129+ name : XEngine_APIServiceApp-x86_64-Windows
130+ path : XEngine_Release/
0 commit comments