1- name : C++ Build with Dependencies
1+ name : windows build workflows
22
3- # on: [push] # 触发条件,推送和拉取请求时,
43on :
5- workflow_dispatch : # 添加这行来启用手动触发
4+ push :
5+ branches : [ "develop" ]
6+ pull_request :
7+ branches : [ "develop" ]
68
79permissions :
8- contents : write
10+ contents : read
911
1012jobs :
1113 build :
1214 strategy :
15+ # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
16+ fail-fast : false
1317 matrix :
14- configuration : [Release]
15- platform : [x86]
18+ configuration : [Debug , Release]
19+ platform : [x86 ,x64 ]
1620
1721 runs-on : windows-latest # 最新的 Windows 环境
1822
1923 steps :
2024 # 检出您的主仓库代码
2125 - name : Checkout main repository code
22- uses : actions/checkout@v3
26+ uses : actions/checkout@v4
27+ with :
28+ ref : ' develop'
2329
2430 # 检出依赖的xengine仓库到指定的xengine目录
2531 - name : Checkout dependency repository (xengine)
26- uses : actions/checkout@v3
32+ uses : actions/checkout@v4
2733 with :
28- repository : libxengine/xengine
29- path : xengine
34+ repository : libxengine/libxengine
35+ path : libxengine
36+
37+ - name : sub module checkout (opensource)
38+ run : |
39+ git submodule init
40+ git submodule update
41+ shell : pwsh
3042
31- - name : Checkout dependency repository (vcpkg)
32- uses : actions/checkout@v3
43+ - name : vcpkg dependency repository
44+ uses : actions/checkout@v4
3345 with :
34- repository : https://github.com/microsoft/vcpkg.git
35- path : vcpkg
46+ repository : microsoft/vcpkg
47+ path : vcpkg
48+
49+ - name : vcpkg install (x86)
50+ if : matrix.platform == 'x86'
51+ run : |
52+ cd vcpkg
53+ ./bootstrap-vcpkg.bat
54+ ./vcpkg.exe install lua:x86-windows opencv[contrib]:x86-windows libqrencode:x86-windows
55+ ./vcpkg.exe integrate install
56+ shell : pwsh
57+ - name : vcpkg install (x64)
58+ if : matrix.platform == 'x64'
59+ run : |
60+ cd vcpkg
61+ ./bootstrap-vcpkg.bat
62+ ./vcpkg.exe install lua:x64-windows opencv[contrib]:x64-windows libqrencode:x64-windows
63+ ./vcpkg.exe integrate install
64+ shell : pwsh
3665
3766 # 设置依赖库的环境变量
3867 - name : Set up Dependency Environment Variables
3968 run : |
40- echo "XENGINE_INCLUDE=${{ github.workspace }}/xengine " | Out-File -FilePath $env:GITHUB_ENV -Append
41- echo "XENGINE_LIB32=${{ github.workspace }}/xengine /XEngine_Windows/x86" | Out-File -FilePath $env:GITHUB_ENV -Append
42- echo "XENGINE_LIB64=${{ github.workspace }}/xengine /XEngine_Windows/x64" | Out-File -FilePath $env:GITHUB_ENV -Append
69+ 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
4372 shell : pwsh
73+ - name : Set code page
74+ run : chcp 65001
4475
4576 # 配置 MSBuild 的路径,准备构建 VC++ 项目
4677 - name : Setup MSBuild
47- uses : microsoft/setup-msbuild@v1.0.2
78+ uses : microsoft/setup-msbuild@v2
4879 # 编译
4980 - name : Build Solution
50- run : msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }}
81+ run : msbuild XEngine_Source/XEngine.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /p:AdditionalOptions="/utf-8"
82+ # 测试
83+ - name : Conditional Step for x86 Release
84+ if : matrix.configuration == 'Release' && matrix.platform == 'x86'
85+ run : |
86+ cp -r XEngine_Source/Release/*.dll XEngine_Release/
87+ cp -r XEngine_Source/Release/*.exe XEngine_Release/
88+ cp -r XEngine_Source/VSCopy_x86.bat XEngine_Release/
89+ cd XEngine_Release
90+ ./VSCopy_x86.bat
91+ ./XEngine_HttpApp.exe -t
92+ shell : pwsh
93+ - name : Conditional Step for x86 Debug
94+ if : matrix.configuration == 'Debug' && matrix.platform == 'x86'
95+ 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/
99+ cd XEngine_Release
100+ ./VSCopy_x86.bat
101+ ./XEngine_HttpApp.exe -t
102+ shell : pwsh
0 commit comments