103 lines
2.9 KiB
YAML
103 lines
2.9 KiB
YAML
name: Nightly Coverage Report
|
|
|
|
on:
|
|
schedule:
|
|
# Runs daily at 00:00 CST (China Standard Time) = 16:00 UTC
|
|
- cron: '0 16 * * *'
|
|
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
coverage:
|
|
name: Nightly Coverage Report
|
|
runs-on: ubuntu-24.04
|
|
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.10']
|
|
fail-fast: false
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
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: |
|
|
# 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: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
lcov libaio-dev
|
|
shell: bash
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip \
|
|
pybind11==3.0 \
|
|
cmake==3.30.0 \
|
|
ninja==1.11.1 \
|
|
pytest \
|
|
pytest-cov \
|
|
pytest-xdist \
|
|
scikit-build-core \
|
|
setuptools_scm
|
|
shell: bash
|
|
|
|
- name: Build with COVERAGE config
|
|
run: |
|
|
cd "$GITHUB_WORKSPACE"
|
|
|
|
CMAKE_GENERATOR="Unix Makefiles" \
|
|
CMAKE_BUILD_PARALLEL_LEVEL="$NPROC" \
|
|
python -m pip install -v . \
|
|
--no-build-isolation \
|
|
--config-settings="cmake.build-type=COVERAGE"
|
|
shell: bash
|
|
|
|
- name: Run Python Tests with Coverage
|
|
run: |
|
|
cd "$GITHUB_WORKSPACE"
|
|
python -m pytest python/tests/ --cov=zvec --cov-report=xml \
|
|
--deselect=python/tests/test_gil_release.py::TestGILRelease::test_gil_released_during_query
|
|
shell: bash
|
|
|
|
- name: Run C++ Tests and Generate Coverage
|
|
run: |
|
|
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
|
|
shell: bash
|
|
|
|
- name: Upload Coverage to Codecov
|
|
uses: codecov/codecov-action@v7
|
|
with:
|
|
files: ./proxima-zvec-filtered.lcov.info,./coverage.xml
|
|
flags: python,cpp,nightly
|
|
name: nightly-linux-py${{ matrix.python-version }}
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|