package.yml 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. name: Package
  2. on: [push, pull_request]
  3. jobs:
  4. Build:
  5. runs-on: windows-2025
  6. strategy:
  7. fail-fast: false
  8. matrix:
  9. architecture: [win32, win64]
  10. library_linkage: [Dynamic, Static]
  11. build_type: [Debug, Release]
  12. env:
  13. GENERATOR: Visual Studio 17 2022
  14. VCPKG_DEFAULT_TRIPLET: ${{ matrix.architecture == 'win32' && 'x86' || 'x64' }}-${{ matrix.library_linkage == 'Dynamic' && 'windows' || 'windows-static-md' }}
  15. steps:
  16. - uses: actions/checkout@v4
  17. - name: Install Dependencies
  18. run: |-
  19. echo "Using vcpkg triplet: $env:VCPKG_DEFAULT_TRIPLET"
  20. C:\vcpkg\vcpkg install freetype[core]
  21. - name: Configure CMake
  22. run: >-
  23. cmake -B Build
  24. -G "$env:GENERATOR"
  25. -A ${{ matrix.architecture == 'win32' && 'Win32' || 'x64' }}
  26. -DRMLUI_WARNINGS_AS_ERRORS=ON
  27. -DBUILD_SHARED_LIBS=${{ matrix.library_linkage == 'Dynamic' && 'ON' || 'OFF' }}
  28. -DVCPKG_TARGET_TRIPLET="$env:VCPKG_DEFAULT_TRIPLET"
  29. -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
  30. -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/Install"
  31. -DRMLUI_INSTALL_TARGETS_DIR=Bin-${{matrix.library_linkage}}/CMake
  32. -DCMAKE_INSTALL_BINDIR=Bin-${{matrix.library_linkage}}/${{matrix.build_type}}
  33. -DCMAKE_INSTALL_LIBDIR=Bin-${{matrix.library_linkage}}/${{matrix.build_type}}
  34. -DCMAKE_INSTALL_INCLUDEDIR=Include
  35. -DCMAKE_INSTALL_DATADIR="."
  36. -DRMLUI_INSTALL_RUNTIME_DEPENDENCIES=OFF
  37. -DRMLUI_INSTALL_LICENSES_AND_BUILD_INFO=ON
  38. -DRMLUI_INSTALL_DEPENDENCIES_DIR="Dependencies/Bin-${{matrix.library_linkage}}"
  39. -DRMLUI_ARCHITECTURE="${{ matrix.architecture }}"
  40. -DRMLUI_COMMIT_DATE="$(git show $env:GITHUB_SHA --no-patch --format=%cd --date=iso)"
  41. -DRMLUI_RUN_ID="$env:GITHUB_RUN_ID"
  42. -DRMLUI_SHA="$env:GITHUB_SHA"
  43. - name: Build
  44. run: cmake --build Build --config ${{ matrix.build_type }}
  45. - name: Install
  46. run: cmake --install Build --config ${{ matrix.build_type }}
  47. - name: Upload artifacts
  48. uses: actions/upload-artifact@v4
  49. with:
  50. name: build-${{ matrix.architecture }}-${{ matrix.library_linkage }}-${{ matrix.build_type }}
  51. path: ${{github.workspace}}/Install/
  52. if-no-files-found: error
  53. Samples:
  54. runs-on: windows-2025
  55. strategy:
  56. fail-fast: false
  57. matrix:
  58. architecture: [win32, win64]
  59. env:
  60. GENERATOR: Visual Studio 17 2022
  61. VCPKG_DEFAULT_TRIPLET: ${{ matrix.architecture == 'win32' && 'x86' || 'x64' }}-windows${{ matrix.architecture == 'win64' && '-release' || '' }}
  62. steps:
  63. - uses: actions/checkout@v4
  64. - uses: actions/checkout@v4
  65. name: Checkout dependency rlottie
  66. with:
  67. repository: 'Samsung/rlottie'
  68. ref: 'd40008707addacb636ff435236d31c694ce2b6cf'
  69. path: 'Dependencies/rlottie'
  70. - name: Install Dependencies
  71. run: |-
  72. echo "Using vcpkg triplet: $env:VCPKG_DEFAULT_TRIPLET"
  73. C:\vcpkg\vcpkg install glfw3[core] freetype[core] lua[core] lunasvg[core]
  74. cd Dependencies\rlottie
  75. cmake -B build -G "$env:GENERATOR" -A ${{ matrix.architecture == 'win32' && 'Win32' || 'x64' }} -DBUILD_SHARED_LIBS=ON -DLOTTIE_MODULE=OFF
  76. cmake --build build --target rlottie --config Release -- "/clp:ErrorsOnly"
  77. - name: Configure CMake
  78. run: >-
  79. cmake -B Build
  80. -G "$env:GENERATOR"
  81. -A ${{ matrix.architecture == 'win32' && 'Win32' || 'x64' }}
  82. --preset samples-all
  83. -DRMLUI_HARFBUZZ_SAMPLE=OFF
  84. -DRMLUI_BACKEND=GLFW_GL3
  85. -DBUILD_SHARED_LIBS=ON
  86. -DRMLUI_WARNINGS_AS_ERRORS=ON
  87. -DVCPKG_TARGET_TRIPLET="$env:VCPKG_DEFAULT_TRIPLET"
  88. -DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
  89. -DCMAKE_INSTALL_PREFIX="${{github.workspace}}/Install"
  90. -DCMAKE_INSTALL_BINDIR="Samples"
  91. -DCMAKE_INSTALL_DATADIR="."
  92. -DRMLUI_INSTALL_LICENSES_AND_BUILD_INFO=ON
  93. -DRMLUI_ARCHITECTURE="${{ matrix.architecture }}"
  94. -DRMLUI_COMMIT_DATE="$(git show $env:GITHUB_SHA --no-patch --format=%cd --date=iso)"
  95. -DRMLUI_RUN_ID="$env:GITHUB_RUN_ID"
  96. -DRMLUI_SHA="$env:GITHUB_SHA"
  97. - name: Build
  98. run: cmake --build Build --config Release
  99. - name: Copy runtime dependencies
  100. run: cp Dependencies/rlottie/build/Release/rlottie.dll Build/Release/
  101. - name: Install
  102. run: cmake --install Build --config Release
  103. - name: Copy readme
  104. run: |-
  105. cp readme.md Install/
  106. cp changelog.md Install/
  107. cp Samples/readme.md Install/Samples/
  108. - name: Copy extra license files
  109. run: |-
  110. cp Dependencies/rlottie/licenses Install/Dependencies/rlottie -Recurse
  111. cp Dependencies/rlottie/COPYING Install/Dependencies/rlottie
  112. echo @'
  113. The rlottie library includes source code licensed under Mozilla Public License Version 2.0.
  114. The source for this code can be found in the rlottie library at the following URL:
  115. https://github.com/Samsung/rlottie/blob/d40008707addacb636ff435236d31c694ce2b6cf/src/vector/vinterpolator.cpp
  116. '@ > "Install/Dependencies/rlottie/vinterpolator.txt"
  117. - uses: actions/upload-artifact@v4
  118. with:
  119. name: samples-${{ matrix.architecture }}
  120. path: |
  121. ${{github.workspace}}/Install/
  122. !${{github.workspace}}/Install/lib/
  123. !${{github.workspace}}/Install/include/
  124. if-no-files-found: error
  125. Package:
  126. needs: [Build, Samples]
  127. runs-on: windows-2025
  128. strategy:
  129. fail-fast: true
  130. matrix:
  131. architecture: [win32, win64]
  132. steps:
  133. # Download artifacts in a well-defined order, with release binaries last.
  134. - uses: actions/download-artifact@v4
  135. with:
  136. name: samples-${{ matrix.architecture }}
  137. - uses: actions/download-artifact@v4
  138. with:
  139. name: build-${{ matrix.architecture }}-Dynamic-Debug
  140. - uses: actions/download-artifact@v4
  141. with:
  142. name: build-${{ matrix.architecture }}-Static-Debug
  143. - uses: actions/download-artifact@v4
  144. with:
  145. name: build-${{ matrix.architecture }}-Dynamic-Release
  146. - uses: actions/download-artifact@v4
  147. with:
  148. name: build-${{ matrix.architecture }}-Static-Release
  149. - uses: actions/upload-artifact@v4
  150. with:
  151. name: RmlUi-vs2022-${{ matrix.architecture }}
  152. path: ./
  153. Release:
  154. needs: [Package]
  155. runs-on: windows-2025
  156. if: ${{ github.ref_type == 'tag' }}
  157. permissions:
  158. contents: write
  159. steps:
  160. - name: Download release artifacts
  161. run: |
  162. $release_artifacts = "RmlUi-vs2022-win64", "RmlUi-vs2022-win32", "samples-win64"
  163. $headers = @{ "Authorization" = "token ${{ secrets.GITHUB_TOKEN }}" }
  164. $response = Invoke-RestMethod -Uri "https://api.github.com/repos/$env:GITHUB_REPOSITORY/actions/runs/$env:GITHUB_RUN_ID/artifacts" -Headers $headers
  165. foreach ($name in $release_artifacts) {
  166. $artifact = $response.artifacts | Where-Object { $_.name -eq $name }
  167. Invoke-WebRequest -Uri $artifact.archive_download_url -OutFile "$name.zip" -Headers $headers
  168. }
  169. - name: Release
  170. uses: softprops/action-gh-release@v2
  171. with:
  172. token: ${{ secrets.RELEASE_TOKEN }}
  173. name: RmlUi ${{ github.ref_name }}
  174. files: "*.zip"
  175. draft: true
  176. fail_on_unmatched_files: true