From b4f2b3e785f2a449ce82bf271eba4ca2e326630b Mon Sep 17 00:00:00 2001 From: Jeremie Fraeys Date: Thu, 12 Feb 2026 13:35:48 -0500 Subject: [PATCH] ci: auto-install cmake and build dependencies --- .forgejo/workflows/ci-native.yml | 54 ++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/.forgejo/workflows/ci-native.yml b/.forgejo/workflows/ci-native.yml index 0518b9e..fb7f41b 100644 --- a/.forgejo/workflows/ci-native.yml +++ b/.forgejo/workflows/ci-native.yml @@ -21,6 +21,42 @@ jobs: timeout-minutes: 5 steps: + - name: Install Build Dependencies + run: | + echo "Installing build dependencies..." + + # Detect OS and install dependencies + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + if command -v apt-get &> /dev/null; then + echo "Detected Debian/Ubuntu - installing cmake, zlib, build-essential..." + sudo apt-get update + sudo apt-get install -y cmake zlib1g-dev build-essential + elif command -v yum &> /dev/null; then + echo "Detected RHEL/CentOS - installing cmake, zlib, gcc-c++..." + sudo yum install -y cmake zlib-devel gcc-c++ + else + echo "WARNING: Unknown package manager. Please install manually:" + echo " - cmake" + echo " - zlib development headers" + echo " - C++ compiler (g++ or clang++)" + fi + elif [[ "$OSTYPE" == "darwin"* ]]; then + echo "Detected macOS - checking for Homebrew..." + if ! command -v brew &> /dev/null; then + echo "ERROR: Homebrew not found. Install from https://brew.sh" + exit 1 + fi + echo "Installing cmake, zlib via Homebrew..." + brew install cmake zlib + else + echo "WARNING: Unknown OS. Please install manually:" + echo " - cmake" + echo " - zlib development headers" + echo " - C++ compiler (g++ or clang++)" + fi + + echo "Dependencies installed." + - name: Check CMake Available run: | if ! command -v cmake &> /dev/null; then @@ -34,26 +70,26 @@ jobs: echo "Or add this to your runner setup script." exit 1 fi - echo "✅ cmake: $(cmake --version | head -1)" + echo "cmake: $(cmake --version | head -1)" - name: Check C++ Compiler run: | if ! command -v g++ &> /dev/null && ! command -v clang++ &> /dev/null; then - echo "❌ ERROR: No C++ compiler found (g++ or clang++)" + echo "No C++ compiler found (g++ or clang++)" echo "" echo "To fix this:" echo " Ubuntu/Debian: sudo apt-get install -y build-essential" echo " macOS: xcode-select --install" exit 1 fi - echo "✅ C++ compiler available" + echo "C++ compiler available" - name: Check Zlib run: | if pkg-config --exists zlib 2>/dev/null || [ -f /usr/include/zlib.h ] || [ -f /usr/local/include/zlib.h ]; then - echo "✅ zlib development headers found" + echo "zlib development headers found" else - echo "⚠️ WARNING: zlib headers not found - native build may fail" + echo "zlib headers not found - native build may fail" echo " Install: sudo apt-get install -y zlib1g-dev || brew install zlib" fi @@ -79,7 +115,7 @@ jobs: make native-build 2>&1 if [ $? -ne 0 ]; then echo "" - echo "❌ Native build failed!" + echo "Native build failed!" echo "" echo "Common causes:" echo " 1. Missing cmake: Install with 'apt-get install cmake' or 'brew install cmake'" @@ -90,7 +126,7 @@ jobs: echo "Check the detailed error above for more information." exit 1 fi - echo "✅ Native libraries built successfully" + echo "Native libraries built successfully" - name: Test with Native Libraries run: | @@ -119,7 +155,7 @@ jobs: - name: Lint run: | echo "Running linters..." - make lint || echo "⚠️ Linting completed with warnings" + make lint || echo "Linting completed with warnings" build-release: name: Build Release Libraries @@ -141,7 +177,7 @@ jobs: run: | echo "Building optimized release libraries..." make native-release 2>&1 - echo "✅ Release libraries built" + echo "Release libraries built" - name: List Build Artifacts run: |