chore: Update CMake and CI workflow for improved build configurations

- Added an option to conditionally build development tools in CMake, enhancing flexibility for local development.
- Improved error handling in the CI workflow for packaging artifacts across Windows, macOS, and Linux, ensuring binaries and assets are correctly identified and managed.
- Refactored test manager methods to return appropriate errors when gRPC features are not enabled, improving clarity in feature availability.
- Included filesystem header in dungeon test harness for enhanced file operations.
This commit is contained in:
scawful
2025-10-09 13:13:48 -04:00
parent 83ad27e6a0
commit 44800ceccc
4 changed files with 57 additions and 17 deletions

View File

@@ -310,24 +310,53 @@ jobs:
mkdir -p stage mkdir -p stage
if [[ "${{ runner.os }}" == "Windows" ]]; then if [[ "${{ runner.os }}" == "Windows" ]]; then
# Windows uses Visual Studio generator: build/bin/Release/
echo "Packaging Windows artifacts..."
if [[ ! -f build/bin/${{ env.BUILD_TYPE }}/yaze.exe ]]; then
echo "::error::Windows binary not found at build/bin/${{ env.BUILD_TYPE }}/yaze.exe"
ls -la build/bin/ || true
exit 1
fi
cp -r build/bin/${{ env.BUILD_TYPE }}/* stage/ cp -r build/bin/${{ env.BUILD_TYPE }}/* stage/
cp -r assets/ stage/assets/ cp -r assets/ stage/assets/
cp LICENSE README.md stage/ cp LICENSE README.md stage/
(cd stage && powershell -Command "Compress-Archive -Path * -DestinationPath ../${ARTIFACT_NAME}.zip") (cd stage && powershell -Command "Compress-Archive -Path * -DestinationPath ../${ARTIFACT_NAME}.zip")
echo "Created ${ARTIFACT_NAME}.zip" echo "Created ${ARTIFACT_NAME}.zip"
echo "PACKAGE_PATH=${ARTIFACT_NAME}.zip" >> "$GITHUB_ENV"
elif [[ "${{ runner.os }}" == "macOS" ]]; then elif [[ "${{ runner.os }}" == "macOS" ]]; then
# For macOS, we stage the .app bundle as a "slice" for the universal merge job # macOS creates app bundle: build/bin/yaze.app
echo "Packaging macOS artifacts..."
if [[ ! -d build/bin/yaze.app ]]; then
echo "::error::macOS app bundle not found at build/bin/yaze.app"
ls -la build/bin/ || true
exit 1
fi
cp -R build/bin/yaze.app stage/yaze.app cp -R build/bin/yaze.app stage/yaze.app
echo "Staged yaze.app slice for ${ARTIFACT_NAME}" echo "Staged yaze.app slice for ${ARTIFACT_NAME}"
echo "PACKAGE_PATH=stage/" >> "$GITHUB_ENV"
else # Linux else # Linux
cp build/bin/yaze stage/ # Linux uses Ninja generator: build/bin/yaze (no subdirectory)
cp -r assets/ stage/assets/ echo "Packaging Linux artifacts..."
if [[ -f build/bin/yaze ]]; then
echo "Found binary at build/bin/yaze"
cp build/bin/yaze stage/
else
echo "::error::Linux binary not found at build/bin/yaze"
ls -la build/bin/ || true
exit 1
fi
# Copy assets from source tree
if [[ -d assets ]]; then
cp -r assets/ stage/assets/
else
echo "::error::Assets directory not found"
exit 1
fi
cp LICENSE README.md stage/ cp LICENSE README.md stage/
tar -czf "${ARTIFACT_NAME}.tar.gz" -C stage . tar -czf "${ARTIFACT_NAME}.tar.gz" -C stage .
echo "Created ${ARTIFACT_NAME}.tar.gz" echo "Created ${ARTIFACT_NAME}.tar.gz"
echo "PACKAGE_PATH=${ARTIFACT_NAME}.tar.gz" >> "$GITHUB_ENV"
fi fi
- name: "Upload Artifact (Windows)" - name: "Upload Artifact (Windows)"

View File

@@ -372,8 +372,12 @@ file(COPY ${AGENT_FILES} DESTINATION "${CMAKE_BINARY_DIR}/assets/agent/")
add_subdirectory(src) add_subdirectory(src)
# Tools # Tools (development utilities - only for local development)
add_subdirectory(tools) option(YAZE_BUILD_TOOLS "Build development utility tools" OFF)
if(YAZE_BUILD_TOOLS)
message(STATUS "Building development tools")
add_subdirectory(tools)
endif()
# Tests # Tests
if (YAZE_BUILD_TESTS) if (YAZE_BUILD_TESTS)

View File

@@ -1865,17 +1865,11 @@ void TestManager::TrimHarnessHistoryLocked() {
harness_history_.erase(oldest_test); harness_history_.erase(oldest_test);
} }
} }
#endif
absl::Status TestManager::ReplayLastPlan() { absl::Status TestManager::ReplayLastPlan() {
return absl::FailedPreconditionError("Harness plan replay not available"); return absl::FailedPreconditionError("Harness plan replay not available");
} }
void TestManager::RecordPlanSummary(const std::string& summary) {
(void)summary;
}
#if defined(YAZE_WITH_GRPC)
absl::Status TestManager::ShowHarnessDashboard() { absl::Status TestManager::ShowHarnessDashboard() {
return absl::OkStatus(); return absl::OkStatus();
} }
@@ -1883,15 +1877,27 @@ absl::Status TestManager::ShowHarnessDashboard() {
absl::Status TestManager::ShowHarnessActiveTests() { absl::Status TestManager::ShowHarnessActiveTests() {
return absl::OkStatus(); return absl::OkStatus();
} }
#endif
void TestManager::SetHarnessListener(HarnessListener* listener) { void TestManager::SetHarnessListener(HarnessListener* listener) {
#if defined(YAZE_WITH_GRPC)
absl::MutexLock lock(&mutex_); absl::MutexLock lock(&mutex_);
harness_listener_ = listener; harness_listener_ = listener;
}
#else #else
(void)listener; absl::Status TestManager::ReplayLastPlan() {
return absl::UnimplementedError("Harness features require YAZE_WITH_GRPC");
}
absl::Status TestManager::ShowHarnessDashboard() {
return absl::UnimplementedError("Harness features require YAZE_WITH_GRPC");
}
absl::Status TestManager::ShowHarnessActiveTests() {
return absl::UnimplementedError("Harness features require YAZE_WITH_GRPC");
}
#endif #endif
void TestManager::RecordPlanSummary(const std::string& summary) {
(void)summary;
} }
} // namespace test } // namespace test

View File

@@ -1,3 +1,4 @@
#include <filesystem>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>