|
| 1 | +name: Nightly CMake Subproject Integration |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run after the other nightly jobs to avoid starting every heavy job at once. |
| 6 | + - cron: '30 16 * * *' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + subproject-integration: |
| 14 | + name: Subproject Build & Example (linux-x64) |
| 15 | + runs-on: ubuntu-24.04 |
| 16 | + timeout-minutes: 90 |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v6 |
| 21 | + with: |
| 22 | + ref: main |
| 23 | + submodules: recursive |
| 24 | + |
| 25 | + - name: Setup ccache |
| 26 | + uses: hendrikmuhs/ccache-action@v1.2 |
| 27 | + with: |
| 28 | + key: cmake-subproject-linux-x64 |
| 29 | + max-size: 150M |
| 30 | + |
| 31 | + - name: Set up Python |
| 32 | + uses: actions/setup-python@v6 |
| 33 | + with: |
| 34 | + python-version: '3.10' |
| 35 | + cache: 'pip' |
| 36 | + cache-dependency-path: 'pyproject.toml' |
| 37 | + |
| 38 | + - name: Install system dependencies |
| 39 | + run: | |
| 40 | + sudo apt-get update |
| 41 | + sudo apt-get install -y --no-install-recommends \ |
| 42 | + libaio-dev |
| 43 | + shell: bash |
| 44 | + |
| 45 | + - name: Set up environment variables |
| 46 | + run: | |
| 47 | + NPROC=$(nproc 2>/dev/null || echo 2) |
| 48 | + echo "NPROC=$NPROC" >> "$GITHUB_ENV" |
| 49 | + echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> "$GITHUB_PATH" |
| 50 | + shell: bash |
| 51 | + |
| 52 | + - name: Install dependencies |
| 53 | + run: | |
| 54 | + python -m pip install --upgrade pip |
| 55 | + python -m pip install \ |
| 56 | + cmake==3.30.0 \ |
| 57 | + ninja==1.11.1 |
| 58 | + shell: bash |
| 59 | + |
| 60 | + - name: Configure subproject integration |
| 61 | + run: | |
| 62 | + SMOKE_SOURCE="$RUNNER_TEMP/zvec-subproject-nightly" |
| 63 | + SMOKE_BUILD="$RUNNER_TEMP/zvec-subproject-nightly-build" |
| 64 | +
|
| 65 | + mkdir -p "$SMOKE_SOURCE" "$SMOKE_BUILD" |
| 66 | + cat > "$SMOKE_SOURCE/CMakeLists.txt" <<'EOF' |
| 67 | + cmake_minimum_required(VERSION 3.13) |
| 68 | + project(zvec_subproject_nightly LANGUAGES C CXX) |
| 69 | + set(CMAKE_CXX_STANDARD 17) |
| 70 | + set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 71 | +
|
| 72 | + if(NOT ZVEC_SOURCE_DIR) |
| 73 | + message(FATAL_ERROR "ZVEC_SOURCE_DIR is required") |
| 74 | + endif() |
| 75 | +
|
| 76 | + add_subdirectory("${ZVEC_SOURCE_DIR}" zvec) |
| 77 | +
|
| 78 | + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") |
| 79 | +
|
| 80 | + add_executable(zvec_embed_db_example |
| 81 | + "${ZVEC_SOURCE_DIR}/examples/c++/db/main.cc") |
| 82 | + target_link_libraries(zvec_embed_db_example PRIVATE zvec_shared) |
| 83 | +
|
| 84 | + add_executable(zvec_embed_core_example |
| 85 | + "${ZVEC_SOURCE_DIR}/examples/c++/core/main.cc") |
| 86 | + target_link_libraries(zvec_embed_core_example PRIVATE zvec_shared) |
| 87 | +
|
| 88 | + add_executable(zvec_embed_ailego_example |
| 89 | + "${ZVEC_SOURCE_DIR}/examples/c++/ailego/main.cc") |
| 90 | + target_link_libraries(zvec_embed_ailego_example PRIVATE zvec_shared) |
| 91 | + EOF |
| 92 | +
|
| 93 | + cmake -S "$SMOKE_SOURCE" -B "$SMOKE_BUILD" -G Ninja \ |
| 94 | + -DZVEC_SOURCE_DIR="$GITHUB_WORKSPACE" \ |
| 95 | + -DCMAKE_BUILD_TYPE=Release \ |
| 96 | + -DBUILD_TOOLS=OFF \ |
| 97 | + -DBUILD_C_BINDINGS=OFF \ |
| 98 | + -DBUILD_PYTHON_BINDINGS=OFF \ |
| 99 | + -DENABLE_WERROR=ON \ |
| 100 | + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ |
| 101 | + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache |
| 102 | +
|
| 103 | + echo "SMOKE_BUILD=$SMOKE_BUILD" >> "$GITHUB_ENV" |
| 104 | + shell: bash |
| 105 | + |
| 106 | + - name: Build subproject targets |
| 107 | + run: | |
| 108 | + cmake --build "$SMOKE_BUILD" --target \ |
| 109 | + core_knn_diskann \ |
| 110 | + zvec_embed_db_example \ |
| 111 | + zvec_embed_core_example \ |
| 112 | + zvec_embed_ailego_example \ |
| 113 | + --parallel "$NPROC" |
| 114 | + shell: bash |
| 115 | + |
| 116 | + - name: Run subproject examples |
| 117 | + run: | |
| 118 | + cd "$SMOKE_BUILD" |
| 119 | + ./bin/zvec_embed_db_example |
| 120 | + ./bin/zvec_embed_core_example |
| 121 | + ./bin/zvec_embed_ailego_example |
| 122 | + shell: bash |
0 commit comments