From 5367b31f4e8885bad782ecd0edf08a286f0d1cc8 Mon Sep 17 00:00:00 2001 From: Nick Koirala Date: Sun, 8 Mar 2026 16:04:38 +1300 Subject: [PATCH] chore: fixing CI --- .gitea/workflows/sync-docs-to-wiki.yml | 4 ++- docs/Scenegraph.md | 2 +- tests/resource_tests.cpp | 41 +++++++++++++++++++++++--- tests/scenegraph_tests.cpp | 31 +++++++++++++++++-- 4 files changed, 70 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/sync-docs-to-wiki.yml b/.gitea/workflows/sync-docs-to-wiki.yml index 3b8ab83..8676fd4 100644 --- a/.gitea/workflows/sync-docs-to-wiki.yml +++ b/.gitea/workflows/sync-docs-to-wiki.yml @@ -27,6 +27,8 @@ jobs: env: WIKI_REPO: git@gitea.appstack.me:nick/simian.wiki.git run: | + sudo apt-get update -qq + sudo apt-get install -y rsync openssh-client git config --global user.name "Simian CI" git config --global user.email "ci@simian.local" git clone "$WIKI_REPO" wiki @@ -37,5 +39,5 @@ jobs: echo "No wiki changes" else git commit -m "Update wiki from docs (CI)" - git push origin HEAD + git push origin main fi diff --git a/docs/Scenegraph.md b/docs/Scenegraph.md index 74382c2..c407130 100644 --- a/docs/Scenegraph.md +++ b/docs/Scenegraph.md @@ -91,4 +91,4 @@ shader_fs = "shaders/toon.fs" uint root = Scene::Load("scenes/demo.toml"); ``` -`Scene::Load` returns a root entity that parents all top-level entities. Entity id `0` can be valid in EnTT, so use `ECS::IsValid(root)` to check success. +`Scene::Load` returns a root entity that parents all top-level entities. Use `ECS::IsValid(root)` to check success on the scene load. diff --git a/tests/resource_tests.cpp b/tests/resource_tests.cpp index b39f22e..22ed42e 100644 --- a/tests/resource_tests.cpp +++ b/tests/resource_tests.cpp @@ -2,6 +2,7 @@ #include "acutest.h" #include #include +#include #include "../include/ShaderManager.h" #include "../include/ModelManager.h" #include "../include/MaterialManager.h" @@ -9,12 +10,35 @@ #include "../include/scripting/ResourceBindings.h" #include "raylib.h" -static void InitRaylibHidden() { +static bool HasDisplay() { +#if defined(_WIN32) + return true; +#elif defined(__APPLE__) + return true; +#else + const char* display = std::getenv("DISPLAY"); + const char* wayland = std::getenv("WAYLAND_DISPLAY"); + return (display && *display) || (wayland && *wayland); +#endif +} + +static bool InitRaylibHidden() { + const char* forceHeadless = std::getenv("SIMIAN_HEADLESS"); + if (forceHeadless && forceHeadless[0] == '1') { + return false; + } + + if (!HasDisplay()) { + return false; + } + if (!IsWindowReady()) { SetConfigFlags(FLAG_WINDOW_HIDDEN); InitWindow(1, 1, "simian_test"); SetTargetFPS(60); } + + return IsWindowReady(); } static void ShutdownRaylibHidden() { @@ -31,7 +55,10 @@ static std::filesystem::path WriteTempShader(const std::filesystem::path& dir, c } void test_shader_manager(void) { - InitRaylibHidden(); + if (!InitRaylibHidden()) { + TEST_SKIP("No display available for raylib"); + return; + } std::filesystem::path tmpDir = std::filesystem::current_path() / "tmp_shader"; std::filesystem::create_directories(tmpDir); @@ -70,7 +97,10 @@ void test_shader_manager(void) { } void test_model_manager(void) { - InitRaylibHidden(); + if (!InitRaylibHidden()) { + TEST_SKIP("No display available for raylib"); + return; + } ModelManager modelManager; Mesh mesh = GenMeshCube(1.0f, 1.0f, 1.0f); @@ -113,7 +143,10 @@ void test_material_manager(void) { } void test_resource_bindings_script(void) { - InitRaylibHidden(); + if (!InitRaylibHidden()) { + TEST_SKIP("No display available for raylib"); + return; + } std::filesystem::path tmpDir = std::filesystem::current_path() / "tmp_resource"; std::filesystem::create_directories(tmpDir); diff --git a/tests/scenegraph_tests.cpp b/tests/scenegraph_tests.cpp index a43d275..256c8a1 100644 --- a/tests/scenegraph_tests.cpp +++ b/tests/scenegraph_tests.cpp @@ -2,6 +2,7 @@ #include "acutest.h" #include #include +#include #include "../include/ECSComponents.h" #include "../include/SceneGraph.h" #include "../include/SceneLoader.h" @@ -10,12 +11,35 @@ #include "raylib.h" #include "entt.hpp" -static void InitRaylibHidden() { +static bool HasDisplay() { +#if defined(_WIN32) + return true; +#elif defined(__APPLE__) + return true; +#else + const char* display = std::getenv("DISPLAY"); + const char* wayland = std::getenv("WAYLAND_DISPLAY"); + return (display && *display) || (wayland && *wayland); +#endif +} + +static bool InitRaylibHidden() { + const char* forceHeadless = std::getenv("SIMIAN_HEADLESS"); + if (forceHeadless && forceHeadless[0] == '1') { + return false; + } + + if (!HasDisplay()) { + return false; + } + if (!IsWindowReady()) { SetConfigFlags(FLAG_WINDOW_HIDDEN); InitWindow(1, 1, "simian_test_scene"); SetTargetFPS(60); } + + return IsWindowReady(); } static void ShutdownRaylibHidden() { @@ -70,7 +94,10 @@ void test_scenegraph_detach(void) { } void test_scene_loader_basic(void) { - InitRaylibHidden(); + if (!InitRaylibHidden()) { + TEST_SKIP("No display available for raylib"); + return; + } entt::registry registry; ModelManager modelManager;