ci.yml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  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: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME 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.45
  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: Linux dependencies
  97. if: ${{ matrix.platform == 'linux' }}
  98. run: |
  99. sudo apt-get update -qq
  100. sudo apt-get install -qqq build-essential pkg-config
  101. - name: Web dependencies
  102. if: ${{ matrix.platform == 'web' }}
  103. uses: mymindstorm/setup-emsdk@v12
  104. with:
  105. version: ${{env.EM_VERSION}}
  106. actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
  107. - name: Install scons
  108. run: |
  109. python -m pip install scons==4.0.0
  110. - name: Setup MinGW for Windows/MinGW build
  111. if: ${{ matrix.platform == 'windows' && matrix.flags == 'use_mingw=yes' }}
  112. uses: egor-tensin/setup-mingw@v2
  113. with:
  114. version: 12.2.0
  115. - name: Generate godot-cpp sources only
  116. run: |
  117. scons platform=${{ matrix.platform }} build_library=no ${{ matrix.flags }}
  118. scons -c
  119. - name: Build godot-cpp (debug)
  120. run: |
  121. scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }}
  122. - name: Build test without rebuilding godot-cpp (debug)
  123. run: |
  124. cd test
  125. scons platform=${{ matrix.platform }} target=template_debug ${{ matrix.flags }} build_library=no
  126. - name: Build test and godot-cpp (release)
  127. run: |
  128. cd test
  129. scons platform=${{ matrix.platform }} target=template_release ${{ matrix.flags }}
  130. - name: Download latest Godot artifacts
  131. uses: dsnopek/action-download-artifact@1322f74e2dac9feed2ee76a32d9ae1ca3b4cf4e9
  132. if: ${{ matrix.run-tests }}
  133. with:
  134. repo: godotengine/godot
  135. branch: master
  136. event: push
  137. workflow: linux_builds.yml
  138. workflow_conclusion: success
  139. name: linux-editor-mono
  140. search_artifacts: true
  141. check_artifacts: true
  142. ensure_latest: true
  143. path: godot-artifacts
  144. - name: Run tests
  145. if: ${{ matrix.run-tests }}
  146. run: |
  147. chmod +x ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono
  148. ./godot-artifacts/godot.linuxbsd.editor.x86_64.mono --headless --version
  149. cd test
  150. # Need to run the editor so .godot is generated... but it crashes! Ignore that :-)
  151. (cd project && (../../godot-artifacts/godot.linuxbsd.editor.x86_64.mono --editor --headless --quit >/dev/null 2>&1 || true))
  152. GODOT=../godot-artifacts/godot.linuxbsd.editor.x86_64.mono ./run-tests.sh
  153. - name: Upload artifact
  154. uses: actions/upload-artifact@v3
  155. with:
  156. name: ${{ matrix.artifact-name }}
  157. path: ${{ matrix.artifact-path }}
  158. if-no-files-found: error
  159. linux-cmake:
  160. name: 🐧 Build (Linux, GCC, CMake)
  161. runs-on: ubuntu-20.04
  162. steps:
  163. - name: Checkout
  164. uses: actions/checkout@v4
  165. with:
  166. submodules: recursive
  167. - name: Install dependencies
  168. run: |
  169. sudo apt-get update -qq
  170. sudo apt-get install -qqq build-essential pkg-config cmake
  171. - name: Build godot-cpp
  172. run: |
  173. cmake -DCMAKE_BUILD_TYPE=Release .
  174. make -j $(nproc) VERBOSE=1
  175. - name: Build test GDExtension library
  176. run: |
  177. cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." .
  178. make -j $(nproc) VERBOSE=1
  179. linux-cmake-ninja:
  180. name: 🐧 Build (Linux, GCC, CMake Ninja)
  181. runs-on: ubuntu-20.04
  182. steps:
  183. - name: Checkout
  184. uses: actions/checkout@v4
  185. with:
  186. submodules: recursive
  187. - name: Install dependencies
  188. run: |
  189. sudo apt-get update -qq
  190. sudo apt-get install -qqq build-essential pkg-config cmake ninja-build
  191. - name: Build godot-cpp
  192. run: |
  193. cmake -DCMAKE_BUILD_TYPE=Release -GNinja .
  194. cmake --build . -j $(nproc) --verbose
  195. - name: Build test GDExtension library
  196. run: |
  197. cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -GNinja .
  198. cmake --build . -j $(nproc) --verbose
  199. windows-msvc-cmake:
  200. name: 🏁 Build (Windows, MSVC, CMake)
  201. runs-on: windows-2019
  202. steps:
  203. - name: Checkout
  204. uses: actions/checkout@v4
  205. with:
  206. submodules: recursive
  207. - name: Build godot-cpp
  208. run: |
  209. cmake -DCMAKE_BUILD_TYPE=Release -G"Visual Studio 16 2019" .
  210. cmake --build . --verbose
  211. - name: Build test GDExtension library
  212. run: |
  213. cd test && cmake -DCMAKE_BUILD_TYPE=Release -DGODOT_HEADERS_PATH="../godot-headers" -DCPP_BINDINGS_PATH=".." -G"Visual Studio 16 2019" .
  214. cmake --build . --verbose