ci.yml 8.2 KB

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