linux_builds.yml 8.8 KB

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