linux_builds.yml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. name: 🐧 Linux Builds
  2. on:
  3. workflow_call:
  4. # Global Settings
  5. env:
  6. # Used for the cache key. Add version suffix to force clean build.
  7. GODOT_BASE_BRANCH: 4.4
  8. GODOT_CPP_BRANCH: 4.4
  9. SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes strict_checks=yes
  10. DOTNET_NOLOGO: true
  11. DOTNET_CLI_TELEMETRY_OPTOUT: true
  12. TSAN_OPTIONS: suppressions=misc/error_suppressions/tsan.txt
  13. UBSAN_OPTIONS: suppressions=misc/error_suppressions/ubsan.txt
  14. jobs:
  15. build-linux:
  16. # Stay one LTS before latest to increase portability of Linux artifacts.
  17. runs-on: ubuntu-22.04
  18. name: ${{ matrix.name }}
  19. timeout-minutes: 120
  20. strategy:
  21. fail-fast: false
  22. matrix:
  23. include:
  24. - name: Editor w/ Mono (target=editor)
  25. cache-name: linux-editor-mono
  26. target: editor
  27. sconsflags: module_mono_enabled=yes
  28. bin: ./bin/godot.linuxbsd.editor.x86_64.mono
  29. build-mono: true
  30. tests: false # Disabled due freeze caused by mix Mono build and CI
  31. doc-test: true
  32. proj-conv: true
  33. api-compat: true
  34. artifact: true
  35. # Validate godot-cpp compatibility on one arbitrary editor build.
  36. godot-cpp: true
  37. cache-limit: 2
  38. - name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, scu_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)
  39. cache-name: linux-editor-double-sanitizers
  40. target: editor
  41. # Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners.
  42. sconsflags: dev_build=yes scu_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold
  43. bin: ./bin/godot.linuxbsd.editor.dev.double.x86_64.san
  44. build-mono: false
  45. tests: true
  46. proj-test: true
  47. # Skip 2GiB artifact speeding up action.
  48. artifact: false
  49. cache-limit: 7
  50. - name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
  51. cache-name: linux-editor-llvm-sanitizers
  52. target: editor
  53. sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
  54. bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san
  55. build-mono: false
  56. tests: true
  57. # Skip 2GiB artifact speeding up action.
  58. artifact: false
  59. # Test our oldest supported SCons/Python versions on one arbitrary editor build.
  60. legacy-scons: true
  61. cache-limit: 7
  62. - name: Editor with ThreadSanitizer (target=editor, tests=yes, dev_build=yes, use_tsan=yes, use_llvm=yes, linker=lld)
  63. cache-name: linux-editor-thread-sanitizer
  64. target: editor
  65. tests: true
  66. sconsflags: dev_build=yes use_tsan=yes use_llvm=yes linker=lld
  67. bin: ./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san
  68. build-mono: false
  69. # Skip 2GiB artifact speeding up action.
  70. artifact: false
  71. cache-limit: 5
  72. - name: Template w/ Mono, release (target=template_release, tests=yes)
  73. cache-name: linux-template-mono
  74. target: template_release
  75. sconsflags: module_mono_enabled=yes
  76. bin: ./bin/godot.linuxbsd.template_release.x86_64.mono
  77. build-mono: false
  78. tests: true
  79. artifact: true
  80. cache-limit: 1
  81. - name: Template w/ Mono, debug (target=template_debug, tests=yes)
  82. cache-name: linux-template-mono-debug
  83. target: template_debug
  84. sconsflags: module_mono_enabled=yes
  85. bin: ./bin/godot.linuxbsd.template_debug.x86_64.mono
  86. build-mono: false
  87. tests: true
  88. artifact: true
  89. cache-limit: 1
  90. - name: Minimal template (target=template_release, tests=yes, everything disabled)
  91. cache-name: linux-template-minimal
  92. target: template_release
  93. sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
  94. bin: ./bin/godot.linuxbsd.template_release.x86_64
  95. tests: true
  96. artifact: true
  97. cache-limit: 1
  98. steps:
  99. - name: Checkout
  100. uses: actions/checkout@v4
  101. with:
  102. submodules: recursive
  103. # Need newer mesa for lavapipe to work properly.
  104. - name: Linux dependencies for tests
  105. if: matrix.proj-test
  106. run: |
  107. sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
  108. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EB8B81E14DA65431D7504EA8F63F0F2B90935439
  109. sudo add-apt-repository "deb https://ppa.launchpadcontent.net/kisak/turtle/ubuntu jammy main"
  110. sudo apt-get install -qq mesa-vulkan-drivers
  111. # TODO: Figure out somehow how to embed this one.
  112. - name: wayland-scanner dependency
  113. run: |
  114. sudo apt-get install libwayland-bin
  115. - name: Free disk space on runner
  116. run: |
  117. echo "Disk usage before:" && df -h
  118. sudo rm -rf /usr/local/lib/android
  119. echo "Disk usage after:" && df -h
  120. - name: Restore Godot build cache
  121. uses: ./.github/actions/godot-cache-restore
  122. with:
  123. cache-name: ${{ matrix.cache-name }}
  124. continue-on-error: true
  125. - name: Setup Python and SCons
  126. if: "!matrix.legacy-scons"
  127. uses: ./.github/actions/godot-deps
  128. - name: Setup Python and SCons (legacy versions)
  129. if: matrix.legacy-scons
  130. uses: ./.github/actions/godot-deps
  131. with:
  132. # Sync with Ensure*Version in SConstruct.
  133. python-version: 3.8
  134. scons-version: 4.0
  135. - name: Force remove preinstalled .NET SDKs
  136. if: matrix.build-mono
  137. run: |
  138. sudo rm -rf /usr/share/dotnet/sdk/*
  139. - name: Setup older .NET SDK as baseline
  140. if: matrix.build-mono
  141. uses: actions/setup-dotnet@v4
  142. with:
  143. # Targeting the oldest version we want to support to ensure it still builds.
  144. dotnet-version: 8.0.100
  145. - name: Compilation
  146. uses: ./.github/actions/godot-build
  147. with:
  148. sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
  149. platform: linuxbsd
  150. target: ${{ matrix.target }}
  151. tests: ${{ matrix.tests }}
  152. scons-cache-limit: ${{ matrix.cache-limit }}
  153. - name: Compilation (godot-cpp)
  154. uses: ./.github/actions/godot-cpp-build
  155. if: matrix.godot-cpp
  156. with:
  157. bin: ${{ matrix.bin }}
  158. scons-flags: target=template_debug dev_build=yes verbose=yes
  159. godot-cpp-branch: ${{ env.GODOT_CPP_BRANCH }}
  160. - name: Save Godot build cache
  161. uses: ./.github/actions/godot-cache-save
  162. with:
  163. cache-name: ${{ matrix.cache-name }}
  164. continue-on-error: true
  165. - name: Generate C# glue
  166. if: matrix.build-mono
  167. run: |
  168. ${{ matrix.bin }} --headless --generate-mono-glue ./modules/mono/glue
  169. - name: Build .NET solutions
  170. if: matrix.build-mono
  171. run: |
  172. dotnet --info
  173. ./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd --werror
  174. - name: Prepare artifact
  175. if: matrix.artifact
  176. run: |
  177. strip bin/godot.*
  178. chmod +x bin/godot.*
  179. - name: Upload artifact
  180. uses: ./.github/actions/upload-artifact
  181. if: matrix.artifact
  182. with:
  183. name: ${{ matrix.cache-name }}
  184. - name: Unit tests
  185. if: matrix.tests
  186. run: |
  187. ${{ matrix.bin }} --version
  188. ${{ matrix.bin }} --help
  189. ${{ matrix.bin }} --headless --test --force-colors
  190. - name: .NET source generators tests
  191. if: matrix.build-mono
  192. run: |
  193. dotnet test modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators.Tests
  194. # Check class reference
  195. - name: Check for class reference updates
  196. if: matrix.doc-test
  197. run: |
  198. echo "Running --doctool to see if this changes the public API without updating the documentation."
  199. echo -e "If a diff is shown, it means that your code/doc changes are incomplete and you should update the class reference with --doctool.\n\n"
  200. ${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true
  201. git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$'
  202. # Check API backwards compatibility
  203. - name: Check for GDExtension compatibility
  204. if: matrix.api-compat
  205. run: |
  206. ./misc/scripts/validate_extension_api.sh "${{ matrix.bin }}"
  207. # Download and run the test project
  208. - name: Test Godot project
  209. uses: ./.github/actions/godot-project-test
  210. if: matrix.proj-test
  211. with:
  212. bin: ${{ matrix.bin }}
  213. # Test the project converter
  214. - name: Test project converter
  215. uses: ./.github/actions/godot-converter-test
  216. if: matrix.proj-conv
  217. with:
  218. bin: ${{ matrix.bin }}