Skip to content

fix: 修复 YAML 缩进问题 #47

fix: 修复 YAML 缩进问题

fix: 修复 YAML 缩进问题 #47

Workflow file for this run

name: Build and Test PyCANDYAlgo
on:
push:
branches: [ main, main-dev, test ]
pull_request:
branches: [ main, main-dev, test ]
workflow_dispatch: # 允许手动触发
jobs:
build-pycandyalgo:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-torch-numpy
restore-keys: |
${{ runner.os }}-pip-
- name: Cache CMake build
uses: actions/cache@v4
with:
path: |
algorithms_impl/build
key: ${{ runner.os }}-cmake-${{ hashFiles('algorithms_impl/CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-cmake-
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
git \
pkg-config \
libgflags-dev \
libgoogle-glog-dev \
libfmt-dev \
libboost-all-dev \
libomp-dev \
libnuma-dev \
libaio-dev
- name: Install Intel MKL
run: |
wget -qO - https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install -y intel-oneapi-mkl-devel || echo "MKL installation warning (non-fatal)"
- name: Run deployment script
run: |
chmod +x deploy.sh
./deploy.sh --skip-system-deps
timeout-minutes: 45
- name: Verify PyCANDYAlgo import
run: |
source sage-db-bench/bin/activate
echo "=== Python Environment ==="
which python3
python3 --version
echo ""
echo "=== Check .so file ==="
SO_FILE=$(find algorithms_impl -name "PyCANDYAlgo*.so" -type f | head -1)
if [ -n "$SO_FILE" ]; then
echo "Found: $SO_FILE"
echo "Size: $(ls -lh "$SO_FILE" | awk '{print $5}')"
else
echo "❌ PyCANDYAlgo.so not found"
exit 1
fi
echo ""
echo "=== Test PyCANDYAlgo Import ==="
python3 << 'EOF'
import PyCANDYAlgo
print('PyCANDYAlgo imported successfully')
print('Version:', PyCANDYAlgo.__version__)
print('Compiled:', PyCANDYAlgo.__compiled_time__)
print()
print('Available classes:')
print('IndexHNSWFlatOptimized:', hasattr(PyCANDYAlgo, 'IndexHNSWFlatOptimized'))
print('MetricType:', hasattr(PyCANDYAlgo, 'MetricType'))
EOF
- name: Test core dependencies
run: |
source sage-db-bench/bin/activate
python3 << 'EOF'
import numpy
import torch
print('numpy:', numpy.__version__)
print('torch:', torch.__version__)
EOF
- name: Upload build logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs
path: |
algorithms_impl/build/cmake_config.log
algorithms_impl/build/CMakeFiles/CMakeError.log
algorithms_impl/build/CMakeFiles/CMakeOutput.log
retention-days: 7
lint:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install linting tools
run: pip install flake8
- name: Run flake8 (syntax errors only)
run: |
flake8 bench/ datasets/ --count --select=E9,F63,F7,F82 --show-source --statistics || true