ci.yml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. name: Continuous integration
  2. on: [push, pull_request]
  3. env:
  4. # Only used for the cache key. Increment version to force clean build.
  5. GODOT_BASE_BRANCH: master
  6. concurrency:
  7. group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
  8. cancel-in-progress: true
  9. jobs:
  10. build:
  11. name: ${{ matrix.name }}
  12. runs-on: ${{ matrix.os }}
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. include:
  17. - name: 🐧 Linux (GCC)
  18. os: ubuntu-20.04
  19. platform: linux
  20. artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
  21. artifact-path: bin/libgodot-cpp.linux.template_release.x86_64.a
  22. run-tests: true
  23. cache-name: linux-x86_64
  24. - name: 🐧 Linux (GCC, Double Precision)
  25. os: ubuntu-20.04
  26. platform: linux
  27. artifact-name: godot-cpp-linux-glibc2.27-x86_64-double-release
  28. artifact-path: bin/libgodot-cpp.linux.template_release.double.x86_64.a
  29. flags: precision=double
  30. run-tests: false
  31. cache-name: linux-x86_64-f64
  32. - name: 🏁 Windows (x86_64, MSVC)
  33. os: windows-2019
  34. platform: windows
  35. artifact-name: godot-cpp-windows-msvc2019-x86_64-release
  36. artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.lib
  37. run-tests: false
  38. cache-name: windows-x86_64-msvc
  39. - name: 🏁 Windows (x86_64, MinGW)
  40. os: windows-2019
  41. platform: windows
  42. artifact-name: godot-cpp-linux-mingw-x86_64-release
  43. artifact-path: bin/libgodot-cpp.windows.template_release.x86_64.a
  44. flags: use_mingw=yes
  45. run-tests: false
  46. cache-name: windows-x86_64-mingw
  47. - name: 🍎 macOS (universal)
  48. os: macos-11
  49. platform: macos
  50. artifact-name: godot-cpp-macos-universal-release
  51. artifact-path: bin/libgodot-cpp.macos.template_release.universal.a
  52. flags: arch=universal
  53. run-tests: false
  54. cache-name: macos-universal
  55. - name: 🤖 Android (arm64)
  56. os: ubuntu-20.04
  57. platform: android
  58. artifact-name: godot-cpp-android-arm64-release
  59. artifact-path: bin/libgodot-cpp.android.template_release.arm64.a
  60. flags: arch=arm64
  61. run-tests: false
  62. cache-name: android-arm64
  63. - name: 🍏 iOS (arm64)
  64. os: macos-11
  65. platform: ios
  66. artifact-name: godot-cpp-ios-arm64-release
  67. artifact-path: bin/libgodot-cpp.ios.template_release.arm64.a
  68. flags: arch=arm64
  69. run-tests: false
  70. cache-name: ios-arm64
  71. - name: 🌐 Web (wasm32)
  72. os: ubuntu-20.04
  73. platform: web
  74. artifact-name: godot-cpp-web-wasm32-release
  75. artifact-path: bin/libgodot-cpp.web.template_release.wasm32.a
  76. run-tests: false
  77. cache-name: web-wasm32
  78. env:
  79. SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
  80. EM_VERSION: 3.1.39
  81. EM_CACHE_FOLDER: "emsdk-cache"
  82. steps:
  83. - name: Checkout
  84. uses: actions/checkout@v4
  85. with:
  86. submodules: recursive
  87. - name: Setup Godot build cache
  88. uses: ./.github/actions/godot-cache
  89. with:
  90. cache-name: ${{ matrix.cache-name }}
  91. continue-on-error: true
  92. - name: Set up Python (for SCons)
  93. uses: actions/setup-python@v4
  94. with:
  95. python-version: '3.x'
  96. - name: Android dependencies
  97. if: ${{ matrix.platform == 'android' }}
  98. uses: nttld/setup-ndk@v1
  99. with:
  100. ndk-version: r23c
  101. link-to-sdk: true
  102. - name: Web dependencies
  103. if: ${{ matrix.platform == 'web' }}
  104. uses: mymindstorm/setup-emsdk@v13
  105. with:
  106. version: ${{env.EM_VERSION}}
  107. actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
  108. - name: Setup MinGW for Windows/MinGW build
  109. if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
  110. uses: egor-tensin/setup-mingw@v2
  111. with:
  112. version: 12.2.0
  113. - name: Install scons
  114. run: |
  115. python -m pip install scons==4.0.0
  116. - name: Generate godot-cpp sources only
  117. run: |
  118. scons platform=${{ matrix.platform }} build_library=no ${{ matrix.flags }}
  119. scons -c
  120. - name: Build godot-cpp (debug)
  121. run: |
  122. scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }}
  123. - name: Build test without rebuilding godot-cpp (debug)
  124. run: |
  125. cd test
  126. scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} build_library=no
  127. - name: Build test and godot-cpp (release)
  128. run: |
  129. cd test
  130. scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }}
  131. - name: Download latest Godot artifacts
  132. uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
  133. if: ${{ matrix.run-tests }}
  134. with:
  135. repo: godotengine/godot
  136. branch: master
  137. event: push
  138. workflow: linux_builds.yml
  139. workflow_conclusion: success
  140. name: linux-editor-mono
  141. search_artifacts: true
  142. check_artifacts: true
  143. ensure_latest: true
  144. path: godot-artifacts
  145. - name: Run tests
  146. if: ${{ matrix.run-tests }}
  147. run: |
  148. chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
  149. ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono --headless --version
  150. cd test
  151. # Need to run the editor so .godot is generated... but it crashes! Ignore that :-)
  152. (cd project && (timeout 10 ../../godot-artifacts/godot.linuxbsd.editor.x86_64.mono --editor --headless --quit >/dev/null 2>&1 || true))
  153. GODOT=../godot-artifacts/godot.linuxbsd.editor.x86_64.mono ./run-tests.sh
  154. - name: Upload artifact
  155. uses: actions/upload-artifact@v3
  156. with:
  157. name: ${{ matrix.artifact-name }}
  158. path: ${{ matrix.artifact-path }}
  159. if-no-files-found: error
  160. linux-cmake:
  161. name: 🐧 Build (Linux, GCC, CMake)
  162. runs-on: ubuntu-20.04
  163. steps:
  164. - name: Checkout
  165. uses: actions/checkout@v4
  166. with:
  167. submodules: recursive
  168. - name: Install dependencies
  169. run: |
  170. sudo apt-get update -qq
  171. sudo apt-get install -qqq build-essential pkg-config cmake
  172. - name: Build godot-cpp
  173. run: |
  174. cmake -DCMAKE_BUILD_TYPE=Release .
  175. make -j $(nproc) VERBOSE=1
  176. - name: Build test GDExtension library
  177. run: |
  178. cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." .
  179. make -j $(nproc) VERBOSE=1
  180. linux-cmake-ninja:
  181. name: 🐧 Build (Linux, GCC, CMake Ninja)
  182. runs-on: ubuntu-20.04
  183. steps:
  184. - name: Checkout
  185. uses: actions/checkout@v4
  186. with:
  187. submodules: recursive
  188. - name: Install dependencies
  189. run: |
  190. sudo apt-get update -qq
  191. sudo apt-get install -qqq build-essential pkg-config cmake ninja-build
  192. - name: Build godot-cpp
  193. run: |
  194. cmake -DCMAKE_BUILD_TYPE=Release -GNinja .
  195. cmake --build . -j $(nproc) --verbose
  196. - name: Build test GDExtension library
  197. run: |
  198. cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -GNinja .
  199. cmake --build . -j $(nproc) --verbose
  200. windows-msvc-cmake:
  201. name: 🏁 Build (Windows, MSVC, CMake)
  202. runs-on: windows-2019
  203. steps:
  204. - name: Checkout
  205. uses: actions/checkout@v4
  206. with:
  207. submodules: recursive
  208. - name: Build godot-cpp
  209. run: |
  210. cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" .
  211. cmake --build . --verbose
  212. - name: Build test GDExtension library
  213. run: |
  214. cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 16 2019" .
  215. cmake --build . --verbose