How can the official Godot build run in GitHub Actions without encountering errors with the Vulkan driver?

I built my custom version of the Godot game engine to include specific features that I need. However, when I try to run it with the following command:

/home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64 /home/runner/work/my-project/project.godot --headless -e --quit

I encounter a crash due to a Vulkan error:

Godot Engine v4.4.dev.mono.custom_build.422eacdc6 - https://godotengine.org

ERROR: Required extension VK_KHR_surface not found.
    at: _initialize_instance_extensions (drivers/vulkan/rendering_context_driver_vulkan.cpp:487)
ERROR: Condition "err != OK" is true. Returning: err
    at: initialize (drivers/vulkan/rendering_context_driver_vulkan.cpp:928)
...

I tried to set up Mesa in the GitHub Actions workflow, but it failed:

- name: Set up Vulkan environment
  run: |
    sudo apt-get update
    sudo apt-get install -y mesa-utils vulkan-tools
    export GDK_BACKEND=x11
    export MESA_GL_VERSION_OVERRIDE=4.5
    export MESA_VK_DEVICE_SELECT=software
    vulkaninfo

The output was:

Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at ./vulkaninfo/vulkaninfo.h:649: vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER

I’m pretty sure I set mesa_libs=/root/mesa in the options when building Godot from source. I don’t know where to go from here, so I’m seeking help from anyone who has resolved this problem before.

Here is the full stacktrace:

  /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64 /home/runner/work/azheir/azheir/azheir/project.godot --headless -e --quit
  Godot Engine v4.4.dev.mono.custom_build.422eacdc6 - https://godotengine.org
  
  ERROR: Required extension VK_KHR_surface not found.
     at: _initialize_instance_extensions (drivers/vulkan/rendering_context_driver_vulkan.cpp:487)
  ERROR: Condition "err != OK" is true. Returning: err
     at: initialize (drivers/vulkan/rendering_context_driver_vulkan.cpp:928)
  ERROR: Do not use progress dialog (task) while flushing the message queue or using call_deferred()!
     at: add_task (editor/progress_dialog.cpp:169)
  ERROR: Condition "!tasks.has(p_task)" is true. Returning: canceled
     at: task_step (editor/progress_dialog.cpp:203)
  ERROR: Condition "!tasks.has(p_task)" is true. Returning: canceled
     at: task_step (editor/progress_dialog.cpp:203)
  ERROR: Condition "!tasks.has(p_task)" is true. Returning: canceled
     at: task_step (editor/progress_dialog.cpp:203)
  ERROR: Condition "!tasks.has(p_task)" is true. Returning: canceled
     at: task_step (editor/progress_dialog.cpp:203)
  ERROR: Required extension VK_KHR_surface not found.
     at: _initialize_instance_extensions (drivers/vulkan/rendering_context_driver_vulkan.cpp:487)
  ERROR: Condition "err != OK" is true. Returning: err
     at: initialize (drivers/vulkan/rendering_context_driver_vulkan.cpp:928)
  ERROR: FATAL: Index p_index = 0 is out of bounds (count = 0).
     at: operator[] (./core/templates/local_vector.h:177)
  ERROR: Caller thread can't call this function in this node (/root). Use call_deferred() or call_thread_group() instead.
     at: propagate_notification (scene/main/node.cpp:2492)
  
  ================================================================
  handle_crash: Program crashed with signal 4
  Engine version: Godot Engine v4.4.dev.mono.custom_build (422eacdc6927df6740e3d0275d135588660f060d)
  Dumping the backtrace. Please include this when reporting the bug to the project developer.
  [1] /usr/share/dotnet/shared/Microsoft.NETCore.App/8.0.8/libcoreclr.so(+0x5e75b5) [0x7fe266de75b5] (??:0)
  [2] /lib/x86_64-linux-gnu/libc.so.6(+0x42520) [0x7fe274042520] (??:0)
  [3] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x39c5da1] (??:0)
  [4] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x39949d0] (??:0)
  [5] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x3a1ec3d] (??:0)
  [6] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x482f68] (??:0)
  [7] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x5df859] (??:0)
  [8] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x496fe8] (??:0)
  [9] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x579744] (??:0)
  [10] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x1516cd6] (??:0)
  [11] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x4319d71] (??:0)
  [12] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x4319e8a] (??:0)
  [13] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x3e563bd] (??:0)
  [14] /home/runner/.local/share/godot/godot_executable/Godot_v4.4-custom_build_mono_linux_x86_64/Godot_v4.4-custom_build_mono_linux.x86_64() [0x4ae16e3] (??:0)
  [15] /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7fe274094ac3] (??:0)
  [16] /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7fe274126850] (??:0)
  -- END OF BACKTRACE --

You don’t want to run it in the editor. Remove the -e option.