Some checks failed
Test / test (push) Waiting to run
Checkout test / test (push) Successful in 4s
CI with Native Libraries / Check Build Environment (push) Failing after 1s
CI with Native Libraries / Build and Test Native Libraries (push) Has been skipped
CI with Native Libraries / Build Release Libraries (push) Has been skipped
Documentation / build-and-publish (push) Has been cancelled
158 lines
5 KiB
YAML
158 lines
5 KiB
YAML
name: CI with Native Libraries
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
workflow_dispatch:
|
|
# Manual trigger for debugging native builds
|
|
|
|
# Global timeout - fail fast if hanging
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
# Pre-flight check to ensure build environment is ready
|
|
check-environment:
|
|
name: Check Build Environment
|
|
runs-on: self-hosted
|
|
timeout-minutes: 5
|
|
|
|
steps:
|
|
- name: Check CMake Available
|
|
run: |
|
|
if ! command -v cmake &> /dev/null; then
|
|
echo "❌ ERROR: cmake is not installed"
|
|
echo ""
|
|
echo "To fix this on your self-hosted runner:"
|
|
echo " Ubuntu/Debian: sudo apt-get install -y cmake zlib1g-dev"
|
|
echo " macOS: brew install cmake zlib"
|
|
echo " CentOS/RHEL: sudo yum install -y cmake zlib-devel"
|
|
echo ""
|
|
echo "Or add this to your runner setup script."
|
|
exit 1
|
|
fi
|
|
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 ""
|
|
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"
|
|
|
|
- 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"
|
|
else
|
|
echo "⚠️ WARNING: zlib headers not found - native build may fail"
|
|
echo " Install: sudo apt-get install -y zlib1g-dev || brew install zlib"
|
|
fi
|
|
|
|
test-native:
|
|
name: Build and Test Native Libraries
|
|
runs-on: self-hosted
|
|
needs: check-environment
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
|
|
- name: Build Native Libraries
|
|
run: |
|
|
echo "Building native C++ libraries..."
|
|
make native-build 2>&1
|
|
if [ $? -ne 0 ]; then
|
|
echo ""
|
|
echo "❌ Native build failed!"
|
|
echo ""
|
|
echo "Common causes:"
|
|
echo " 1. Missing cmake: Install with 'apt-get install cmake' or 'brew install cmake'"
|
|
echo " 2. Missing C++ compiler: Install with 'apt-get install build-essential'"
|
|
echo " 3. Missing zlib: Install with 'apt-get install zlib1g-dev'"
|
|
echo " 4. CMakeLists.txt not found: Ensure native/CMakeLists.txt exists"
|
|
echo ""
|
|
echo "Check the detailed error above for more information."
|
|
exit 1
|
|
fi
|
|
echo "✅ Native libraries built successfully"
|
|
|
|
- name: Test with Native Libraries
|
|
run: |
|
|
echo "Running tests WITH native libraries enabled..."
|
|
FETCHML_NATIVE_LIBS=1 go test -v ./tests/...
|
|
env:
|
|
FETCHML_NATIVE_LIBS: "1"
|
|
continue-on-error: true
|
|
|
|
- name: Test Fallback (Go only)
|
|
run: |
|
|
echo "Running tests WITHOUT native libraries (Go fallback)..."
|
|
FETCHML_NATIVE_LIBS=0 go test -v ./tests/...
|
|
env:
|
|
FETCHML_NATIVE_LIBS: "0"
|
|
|
|
- name: Run Benchmarks
|
|
run: |
|
|
echo "Running performance benchmarks..."
|
|
echo "=== Go Implementation ==="
|
|
FETCHML_NATIVE_LIBS=0 go test -bench=. ./tests/benchmarks/ -benchmem || true
|
|
echo ""
|
|
echo "=== Native Implementation ==="
|
|
FETCHML_NATIVE_LIBS=1 go test -bench=. ./tests/benchmarks/ -benchmem || true
|
|
|
|
- name: Lint
|
|
run: |
|
|
echo "Running linters..."
|
|
make lint || echo "⚠️ Linting completed with warnings"
|
|
|
|
build-release:
|
|
name: Build Release Libraries
|
|
runs-on: self-hosted
|
|
needs: test-native
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 1
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25'
|
|
|
|
- name: Build Release Libraries
|
|
run: |
|
|
echo "Building optimized release libraries..."
|
|
make native-release 2>&1
|
|
echo "✅ Release libraries built"
|
|
|
|
- name: List Build Artifacts
|
|
run: |
|
|
echo "Built libraries:"
|
|
ls -lh native/build/lib* 2>/dev/null || echo "No libraries found in native/build/"
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: native-libs-${{ runner.os }}-${{ runner.arch }}
|
|
path: |
|
|
native/build/lib*.so
|
|
native/build/lib*.dylib
|
|
continue-on-error: true
|