ci.yml 9.1 KB

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