feat(ci): ci workflow with github-hosted runner (#171)

* feat: linux ci with github runner

* fix: add CFLAGS with -march=native

* fix: fix linux x86 ci

* fix: with zen3 in x86 ci

* feat: nightly report with github-runner

* feat: refactor ci workflow

* feat: rename workflow

* feat: rename job

* feat: update ci badge

* feat: remove python coverage
This commit is contained in:
Cuiys 2026-02-26 10:47:55 +08:00 committed by GitHub
parent 17d931fabf
commit 88439c69e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 126 additions and 404 deletions

View File

@ -17,7 +17,7 @@ jobs:
benchmark:
runs-on: vdbbench
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Run VectorDBBench
env:

View File

@ -1,148 +0,0 @@
name: Zvec LinuxARM64 CI
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: pr-${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Zvec LinuxARM64 CI
runs-on: linux_arm64
strategy:
matrix:
python-version: ['3.10']
fail-fast: false
container:
image: quay.io/pypa/manylinux_2_28_aarch64:2024-03-10-4935fcc
options: --user root
steps:
- name: Set up Python path for manylinux
run: |
case "${{ matrix.python-version }}" in
"3.10") PY_PATH="/opt/python/cp310-cp310" ;;
"3.11") PY_PATH="/opt/python/cp311-cp311" ;;
"3.12") PY_PATH="/opt/python/cp312-cp312" ;;
*) echo "Unsupported Python version: ${{ matrix.python-version }}"; exit 1 ;;
esac
echo "PYTHON_BIN=$PY_PATH/bin/python" >> $GITHUB_ENV
echo "PIP_BIN=$PY_PATH/bin/pip" >> $GITHUB_ENV
echo "CLANG_FORMATTER_BIN=$PY_PATH/bin/clang-format" >> $GITHUB_ENV
$PY_PATH/bin/python --version
shell: bash
- name: Prepare clean build directory
run: |
export CLEAN_WORKSPACE="/tmp/zvec"
mkdir -p "$CLEAN_WORKSPACE"
cd "$CLEAN_WORKSPACE"
git config --global --add safe.directory "$CLEAN_WORKSPACE"
git clone --recursive "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
if [ -n "${{ github.event.number }}" ]; then
git fetch origin "pull/${{ github.event.number }}/head"
git checkout FETCH_HEAD
else
git checkout "${{ github.sha }}"
fi
echo "CLEAN_WORKSPACE=$CLEAN_WORKSPACE" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Install dependencies
run: |
${{ env.PIP_BIN }} install --upgrade pip \
ruff==v0.14.4 \
clang-format==18.1.8 \
pybind11==3.0 \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
pytest-cov \
scikit-build-core \
setuptools_scm
shell: bash
- name: Run Ruff Linter
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m ruff check .
shell: bash
- name: Run Ruff Formatter Check
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m ruff format --check .
shell: bash
- name: Run clang-format Check
run: |
cd "$CLEAN_WORKSPACE"
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
! -path "./scripts/*" \
! -path "./python/*" \
! -path "./thirdparty/*" \
! -path "./.git/*")
if [ -z "$CPP_FILES" ]; then
echo "No C++ files found to check."
exit 0
fi
${{ env.CLANG_FORMATTER_BIN }} --dry-run --Werror $CPP_FILES
shell: bash
- name: Install Python dependencies and build package
run: |
cd "$CLEAN_WORKSPACE"
NPROC=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)
CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
${{ env.PIP_BIN }} install -v . \
--no-build-isolation \
--config-settings='cmake.define.BUILD_TOOLS="ON"'
shell: bash
- name: Run Python Tests with Coverage
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m pytest python/tests/ --cov=zvec --cov-report=xml --no-cov-on-fail
shell: bash
- name: Run Cpp Tests
run: |
cd "$CLEAN_WORKSPACE/build"
make unittest -j$(nproc)
shell: bash
- name: Run Cpp Examples
run: |
cd "$CLEAN_WORKSPACE/examples/c++"
mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release
make -j $(nproc) && ./db-example && ./core-example && ./ailego-example
shell: bash

View File

@ -1,153 +0,0 @@
name: Zvec LinuxX64 CI
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
merge_group:
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
workflow_dispatch:
concurrency:
group: pr-${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Zvec LinuxX64 CI
runs-on: linux_x64
strategy:
matrix:
python-version: ['3.10']
fail-fast: false
container:
image: quay.io/pypa/manylinux_2_28_x86_64:2024-03-10-4935fcc
options: --user root
steps:
- name: Set up Python path for manylinux
run: |
case "${{ matrix.python-version }}" in
"3.10") PY_PATH="/opt/python/cp310-cp310" ;;
"3.11") PY_PATH="/opt/python/cp311-cp311" ;;
"3.12") PY_PATH="/opt/python/cp312-cp312" ;;
*) echo "Unsupported Python version: ${{ matrix.python-version }}"; exit 1 ;;
esac
echo "PYTHON_BIN=$PY_PATH/bin/python" >> $GITHUB_ENV
echo "PIP_BIN=$PY_PATH/bin/pip" >> $GITHUB_ENV
echo "CLANG_FORMATTER_BIN=$PY_PATH/bin/clang-format" >> $GITHUB_ENV
$PY_PATH/bin/python --version
# Set number of processors for parallel builds
NPROC=$(nproc 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo "Using $NPROC parallel jobs for builds"
# Add Python user base bin to PATH for pip-installed CLI tools
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: |
${{ env.PYTHON_BIN }} -m pip install --upgrade pip \
ruff==v0.14.4 \
clang-format==18.1.8 \
pybind11==3.0 \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
pytest-cov \
scikit-build-core \
setuptools_scm
shell: bash
- name: Prepare clean build directory
run: |
export CLEAN_WORKSPACE="/tmp/zvec"
mkdir -p "$CLEAN_WORKSPACE"
cd "$CLEAN_WORKSPACE"
git config --global --add safe.directory "$CLEAN_WORKSPACE"
git clone --recursive "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
if [ -n "${{ github.event.number }}" ]; then
git fetch origin "pull/${{ github.event.number }}/head"
git checkout FETCH_HEAD
else
git checkout "${{ github.sha }}"
fi
echo "CLEAN_WORKSPACE=$CLEAN_WORKSPACE" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
- name: Run Ruff Linter
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m ruff check .
shell: bash
- name: Run Ruff Formatter Check
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m ruff format --check .
shell: bash
- name: Run clang-format Check
run: |
cd "$CLEAN_WORKSPACE"
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
! -path "./scripts/*" \
! -path "./python/*" \
! -path "./thirdparty/*" \
! -path "./.git/*")
if [ -z "$CPP_FILES" ]; then
echo "No C++ files found to check."
exit 0
fi
${{ env.CLANG_FORMATTER_BIN }} --dry-run --Werror $CPP_FILES
shell: bash
- name: Install Python dependencies and build package
run: |
cd "$CLEAN_WORKSPACE"
CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
${{ env.PYTHON_BIN }} -m pip install -v . \
--no-build-isolation \
--config-settings='cmake.define.BUILD_TOOLS="ON"'
shell: bash
- name: Run Python Tests with Coverage
run: |
cd "$CLEAN_WORKSPACE"
${{ env.PYTHON_BIN }} -m pytest python/tests/ --cov=zvec --cov-report=xml --no-cov-on-fail
shell: bash
- name: Run Cpp Tests
run: |
cd "$CLEAN_WORKSPACE/build"
make unittest -j$NPROC
shell: bash
- name: Run Cpp Examples
run: |
cd "$CLEAN_WORKSPACE/examples/c++"
mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release
make -j $NPROC && ./db-example && ./core-example && ./ailego-example
shell: bash

View File

@ -1,4 +1,4 @@
name: Zvec MacArm64 CI
name: Main
on:
push:
@ -13,76 +13,45 @@ on:
workflow_dispatch:
concurrency:
group: pr-${{ github.workflow }}-${{ github.event.pull_request.number }}
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || '' }}-${{ github.base_ref || '' }}-${{ github.ref != 'refs/heads/main' || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Zvec MacArm64 CI
runs-on: macos-15
strategy:
matrix:
python-version: ['3.10']
fail-fast: false
# Code quality checks (fast, run first)
lint:
name: Code Quality Checks
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Set up environment variables
run: |
# Set number of processors for parallel builds
NPROC=$(sysctl -n hw.ncpu 2>/dev/null || echo 2)
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo "Using $NPROC parallel jobs for builds"
# Add Python user base bin to PATH for pip-installed CLI tools
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
- name: Install linting tools
run: |
python -m pip install --upgrade pip \
ruff==v0.14.4 \
clang-format==18.1.8 \
pybind11==3.0 \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
pytest-cov \
scikit-build-core \
setuptools_scm
clang-format==18.1.8
shell: bash
- name: Run Ruff Linter
run: |
cd "$GITHUB_WORKSPACE"
python -m ruff check .
run: python -m ruff check .
shell: bash
- name: Run Ruff Formatter Check
run: |
cd "$GITHUB_WORKSPACE"
python -m ruff format --check .
run: python -m ruff format --check .
shell: bash
- name: Run clang-format Check
run: |
cd "$GITHUB_WORKSPACE"
CPP_FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.cc" -o -name "*.cxx" \) \
! -path "./build/*" \
! -path "./tests/*" \
@ -99,6 +68,67 @@ jobs:
clang-format --dry-run --Werror $CPP_FILES
shell: bash
# Build and test matrix (parallel execution)
build-and-test:
name: Build & Test (${{ matrix.platform }})
needs: lint
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
platform: macos-arm64
arch_flag: "" # ARM64 uses auto-detection
- os: ubuntu-24.04-arm
platform: linux-arm64
arch_flag: "" # ARM64 uses auto-detection
- os: ubuntu-24.04
platform: linux-x64
# FIXME: ENABLE_ZEN3 is hardcoded for the current GitHub-hosted runner (AMD EPYC 7T83).
# This should be removed once #101 is resolved.
arch_flag: "--config-settings='cmake.define.ENABLE_ZEN3=\"ON\"'"
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Set up environment variables
run: |
# Set number of processors for parallel builds
if [[ "${{ matrix.platform }}" == "macos-arm64" ]]; then
NPROC=$(sysctl -n hw.ncpu 2>/dev/null || echo 2)
else
NPROC=$(nproc 2>/dev/null || echo 2)
fi
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo "Using $NPROC parallel jobs for builds"
# Add Python user base bin to PATH for pip-installed CLI tools
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
shell: bash
- name: Install dependencies
run: |
python -m pip install --upgrade pip \
pybind11==3.0 \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
scikit-build-core \
setuptools_scm
shell: bash
- name: Build from source
run: |
cd "$GITHUB_WORKSPACE"
@ -107,26 +137,29 @@ jobs:
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
python -m pip install -v . \
--no-build-isolation \
--config-settings='cmake.define.BUILD_TOOLS="ON"'
--config-settings='cmake.define.BUILD_TOOLS="ON"' \
${{ matrix.arch_flag }}
shell: bash
- name: Run Cpp Tests
- name: Run C++ Tests
run: |
cd "$GITHUB_WORKSPACE/build"
make unittest -j$NPROC
shell: bash
- name: Run Python Tests with Coverage
- name: Run Python Tests
run: |
cd "$GITHUB_WORKSPACE"
python -m pytest python/tests/ --cov=zvec --cov-report=xml --no-cov-on-fail
python -m pytest python/tests/
shell: bash
- name: Run Cpp Examples
- name: Run C++ Examples
run: |
cd "$GITHUB_WORKSPACE/examples/c++"
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j $NPROC && ./db-example && ./core-example && ./ailego-example
shell: bash
make -j $NPROC
./db-example
./core-example
./ailego-example
shell: bash

View File

@ -13,78 +13,72 @@ permissions:
jobs:
coverage:
name: Nightly Coverage Report
runs-on: linux_x64
runs-on: ubuntu-24.04
strategy:
matrix:
python-version: ['3.10']
fail-fast: false
container:
image: zvec-registry.cn-hongkong.cr.aliyuncs.com/zvec/zvec:0.0.2
options: --user root
steps:
- name: Activate Conda environment
- name: Checkout code
uses: actions/checkout@v6
with:
ref: main # Always use main for nightly
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: 'pyproject.toml'
- name: Set up environment variables
run: |
if [[ "${{ matrix.python-version }}" == "3.10" ]]; then
ENV_NAME="py310"
elif [[ "${{ matrix.python-version }}" == "3.11" ]]; then
ENV_NAME="py311"
elif [[ "${{ matrix.python-version }}" == "3.12" ]]; then
ENV_NAME="py312"
else
echo "Unsupported Python version"
exit 1
fi
echo "CONDA_ENV_NAME=$ENV_NAME" >> $GITHUB_ENV
source /opt/miniforge3/bin/activate "$ENV_NAME"
python --version
# Set number of processors for parallel builds
NPROC=$(nproc 2>/dev/null || echo 2)
echo "NPROC=$NPROC" >> $GITHUB_ENV
echo "Using $NPROC parallel jobs for builds"
# Add Python user base bin to PATH for pip-installed CLI tools
echo "$(python -c 'import site; print(site.USER_BASE)')/bin" >> $GITHUB_PATH
shell: bash
- name: Prepare clean build directory
- name: Install dependencies
run: |
export CLEAN_WORKSPACE="/tmp/zvec"
mkdir -p "$CLEAN_WORKSPACE"
cd "$CLEAN_WORKSPACE"
git config --global --add safe.directory "$CLEAN_WORKSPACE"
git clone --recursive "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" .
git checkout main # Always use main for nightly
echo "CLEAN_WORKSPACE=$CLEAN_WORKSPACE" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
python -m pip install --upgrade pip \
cmake==3.30.0 \
ninja==1.11.1 \
pytest \
pytest-cov \
scikit-build-core \
setuptools_scm
shell: bash
- name: Build with COVERAGE config
run: |
source /opt/miniforge3/bin/activate "${{ env.CONDA_ENV_NAME }}"
cd "$CLEAN_WORKSPACE"
pip install --upgrade pip pytest pytest-cov
NPROC=$(nproc 2>/dev/null || echo 2)
echo "Using $NPROC parallel jobs"
cd "$GITHUB_WORKSPACE"
CMAKE_GENERATOR="Unix Makefiles" \
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
pip install -v . \
--config-settings="cmake.build-type=COVERAGE"
python -m pip install -v . \
--no-build-isolation \
--config-settings="cmake.build-type=COVERAGE" \
--config-settings='cmake.define.ENABLE_ZEN3="ON"'
shell: bash
- name: Run Python Tests with Coverage
run: |
source /opt/miniforge3/bin/activate "${{ env.CONDA_ENV_NAME }}"
cd "$CLEAN_WORKSPACE"
cd "$GITHUB_WORKSPACE"
python -m pytest python/tests/ --cov=zvec --cov-report=xml
shell: bash
- name: Run C++ Tests and Generate Coverage
run: |
cd "$CLEAN_WORKSPACE/build"
make unittest -j$(nproc) # Run all (nightly can afford it)
cd "$CLEAN_WORKSPACE"
cd "$GITHUB_WORKSPACE/build"
make unittest -j$NPROC
cd "$GITHUB_WORKSPACE"
# Ensure gcov.sh is executable
chmod +x scripts/gcov.sh
bash scripts/gcov.sh -k
@ -93,7 +87,7 @@ jobs:
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ${{ env.CLEAN_WORKSPACE }}/proxima-zvec-filtered.lcov.info,${{ env.CLEAN_WORKSPACE }}/coverage.xml
files: ./proxima-zvec-filtered.lcov.info,./coverage.xml
flags: python,cpp,nightly
name: nightly-linux-py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}

View File

@ -6,11 +6,8 @@
</div>
<p align="center">
<a href="https://github.com/alibaba/zvec/actions/workflows/linux_x64_docker_ci.yml"><img src="https://github.com/alibaba/zvec/actions/workflows/linux_x64_docker_ci.yml/badge.svg?branch=main" alt="Linux x64 CI"/></a>
<a href="https://github.com/alibaba/zvec/actions/workflows/linux_arm64_docker_ci.yml"><img src="https://github.com/alibaba/zvec/actions/workflows/linux_arm64_docker_ci.yml/badge.svg?branch=main" alt="Linux ARM64 CI"/></a>
<a href="https://github.com/alibaba/zvec/actions/workflows/mac_arm64_ci.yml"><img src="https://github.com/alibaba/zvec/actions/workflows/mac_arm64_ci.yml/badge.svg?branch=main" alt="macOS ARM64 CI"/></a>
<br>
<a href="https://codecov.io/github/alibaba/zvec"><img src="https://codecov.io/github/alibaba/zvec/graph/badge.svg?token=O81CT45B66" alt="Code Coverage"/></a>
<a href="https://github.com/alibaba/zvec/actions/workflows/main.yml"><img src="https://github.com/alibaba/zvec/actions/workflows/main.yml/badge.svg?branch=main" alt="Main"/></a>
<a href="https://pypi.org/project/zvec/"><img src="https://img.shields.io/pypi/v/zvec.svg" alt="PyPI Release"/></a>
<a href="https://pypi.org/project/zvec/"><img src="https://img.shields.io/pypi/pyversions/zvec.svg" alt="Python Versions"/></a>
<a href="https://github.com/alibaba/zvec/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg" alt="License"/></a>
@ -25,8 +22,7 @@
<a href="https://zvec.org/en/">🏠 <strong>Home</strong> </a> |
<a href="https://zvec.org/en/docs/">📚 <strong>Docs</strong> </a> |
<a href="https://zvec.org/en/docs/benchmarks/">📊 <strong>Benchmarks</strong> </a> |
<a href="https://discord.gg/rKddFBBu9z">🎮 <strong>Discord</strong> </a> |
<a href="https://x.com/zvec_ai">🐦 <strong>X (Twitter)</strong> </a>
<a href="https://discord.gg/rKddFBBu9z">🎮 <strong>Discord</strong> </a>
</p>
**Zvec** is an open-source, in-process vector database — lightweight, lightning-fast, and designed to embed directly into applications. Built on **Proxima** (Alibaba's battle-tested vector search engine), it delivers production-grade, low-latency, scalable similarity search with minimal setup.