Fix CI/CD Arrow build issues #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Test | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| # For faster builds with OpenCV, consider using larger runners (requires GitHub subscription): | |
| # Standard runner: 2-core CPU, 7GB RAM | |
| # Larger runner: 4-core CPU, 14GB RAM (2x faster for parallel builds like OpenCV) | |
| # To use larger runner, change to: runs-on: ubuntu-latest-4-cores | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 150 | |
| steps: | |
| - name: Check initial disk space | |
| run: | | |
| df -h | |
| echo "Available disk space:" | |
| df -h / | tail -1 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| bison \ | |
| flex \ | |
| build-essential \ | |
| cmake \ | |
| make \ | |
| autoconf \ | |
| autoconf-archive \ | |
| automake \ | |
| libtool \ | |
| libltdl-dev \ | |
| libx11-dev \ | |
| libxft-dev \ | |
| libxext-dev \ | |
| libxtst-dev \ | |
| libxrandr-dev \ | |
| ninja-build \ | |
| pkg-config | |
| sudo apt-get clean | |
| sudo rm -rf /var/lib/apt/lists/* | |
| - name: Cache vcpkg packages | |
| uses: actions/cache@v4 | |
| id: vcpkg-cache | |
| with: | |
| path: | | |
| ${{ github.workspace }}/build/vcpkg_installed | |
| ${{ github.workspace }}/vcpkg/downloads | |
| key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}-${{ hashFiles('**/vcpkg.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}- | |
| ${{ runner.os }}-vcpkg- | |
| - name: Bootstrap vcpkg | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| chmod +x ./vcpkg/bootstrap-vcpkg.sh | |
| ./vcpkg/bootstrap-vcpkg.sh | |
| - name: Set vcpkg environment variables | |
| run: | | |
| echo "VCPKG_ROOT=${{ github.workspace }}/vcpkg" >> $GITHUB_ENV | |
| echo "${{ github.workspace }}/vcpkg" >> $GITHUB_PATH | |
| echo "VCPKG_DEFAULT_TRIPLET=x64-linux-release" >> $GITHUB_ENV | |
| echo "VCPKG_FORCE_SYSTEM_BINARIES=0" >> $GITHUB_ENV | |
| - name: Check disk space before CMake | |
| run: | | |
| df -h | |
| du -sh ${{ github.workspace }}/* 2>/dev/null | sort -h | tail -10 | |
| echo "=== /tmp usage ===" | |
| df -h /tmp || true | |
| - name: Clean /tmp before build | |
| run: | | |
| sudo rm -rf /tmp/* /tmp/.* 2>/dev/null || true | |
| df -h /tmp || true | |
| - name: Configure CMake | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| # Verify triplet is set correctly | |
| echo "VCPKG_DEFAULT_TRIPLET=${VCPKG_DEFAULT_TRIPLET}" | |
| # Verify build tools are available | |
| which cmake | |
| which make | |
| which ninja | |
| cmake --version | |
| make --version || true | |
| ninja --version || true | |
| cmake -S . -B build \ | |
| -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DVCPKG_TARGET_TRIPLET=x64-linux-release | |
| - name: Clean up vcpkg build artifacts (keep cached packages) | |
| run: | | |
| # Clean up vcpkg buildtrees to save disk space | |
| # Keep downloads/ and build/vcpkg_installed/ for caching | |
| if [ -d "${{ github.workspace }}/vcpkg/buildtrees" ]; then | |
| rm -rf ${{ github.workspace }}/vcpkg/buildtrees | |
| fi | |
| if [ -d "${{ github.workspace }}/build/vcpkg_installed" ]; then | |
| find ${{ github.workspace }}/build/vcpkg_installed -name "buildtrees" -type d -exec rm -rf {} + 2>/dev/null || true | |
| fi | |
| df -h | |
| - name: Build C++ project | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| # Clean /tmp before starting build | |
| sudo find /tmp -type f -mmin +5 -delete 2>/dev/null || true | |
| df -h /tmp || true | |
| cmake --build build --parallel $(nproc) | |
| # Clean /tmp after build | |
| sudo find /tmp -type f -mmin +1 -delete 2>/dev/null || true | |
| - name: Clean up build artifacts (keep only binaries) | |
| run: | | |
| if [ -d "${{ github.workspace }}/build" ]; then | |
| find ${{ github.workspace }}/build -name "*.o" -delete | |
| find ${{ github.workspace }}/build -name "*.a" -delete | |
| find ${{ github.workspace }}/build -name "CMakeFiles" -type d -exec rm -rf {} + 2>/dev/null || true | |
| fi | |
| df -h | |
| - name: Verify build | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| echo "=== C++ Build Verification ===" | |
| ls -la build/ | |
| echo "" | |
| echo "=== Built executables ===" | |
| find build -type f -executable -name "*" ! -name "*.so" ! -name "*.a" | head -20 | |