|
| 1 | +name: windows build workflows |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "develop" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "develop" ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + 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 |
| 17 | + matrix: |
| 18 | + configuration: [Debug ,Release] |
| 19 | + platform: [x86 ,x64] |
| 20 | + |
| 21 | + runs-on: windows-latest # 最新的 Windows 环境 |
| 22 | + |
| 23 | + steps: |
| 24 | + # 检出您的主仓库代码 |
| 25 | + - name: Checkout main repository code |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + ref: 'develop' |
| 29 | + |
| 30 | + # 检出依赖的xengine仓库到指定的xengine目录 |
| 31 | + - name: Checkout dependency repository (xengine) |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 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 |
| 42 | + |
| 43 | + - name: vcpkg dependency repository |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 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 libsrt:x86-windows libsrtp: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 libsrt:x64-windows libsrtp:x64-windows |
| 63 | + ./vcpkg.exe integrate install |
| 64 | + shell: pwsh |
| 65 | + |
| 66 | + # 设置依赖库的环境变量 |
| 67 | + - name: Set up Dependency Environment Variables |
| 68 | + run: | |
| 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 |
| 72 | + shell: pwsh |
| 73 | + - name: Set code page |
| 74 | + run: chcp 65001 |
| 75 | + |
| 76 | + # 配置 MSBuild 的路径,准备构建 VC++ 项目 |
| 77 | + - name: Setup MSBuild |
| 78 | + uses: microsoft/setup-msbuild@v2 |
| 79 | + #编译 |
| 80 | + - name: Build Solution |
| 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_StreamMediaApp.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_StreamMediaApp.exe -t |
| 102 | + shell: pwsh |
0 commit comments