ci.yml 7.6 KB

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