Repository navigation
131 lines (117 loc) · 4.38 KB
/
Copy pathpython.yml
File metadata and controls
131 lines (117 loc) · 4.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Python Wheel
on:
push:
branches: ["main", "master"]
pull_request:
branches: ["main", "master"]
concurrency:
group: ${{ github.event.pull_request.number || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: read
jobs:
changes:
uses: ./.github/workflows/changes.yml
python-quality:
needs: changes
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.python_quality == 'true') }}
name: Python formatting and linting
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.11"
cache: pip
- name: Install validation dependencies
run: python -m pip install "ruff==0.16.1" numpy pytest
- name: Check Python
run: ./scripts/check-python.sh
- name: Check release automation
run: |
ruff format --check .github/scripts
ruff check .github/scripts
python -m unittest discover -s .github/scripts -p 'test_*.py'
- name: Test benchmark protocols without native builds
run: python -m pytest tests/python/test_benchmark_protocol.py --tb=short -q
python-build:
needs: changes
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.python_build == 'true') }}
name: Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.14"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Verify runner CMake
run: cmake --version
- name: Upgrade pip
run: pip install --upgrade pip
- name: Build and install wheel
run: pip install ".[test]" -v
# Repaired-wheel jobs run the full Python suite.
- name: Smoke-test source installation
run: >-
python -m pytest --tb=short -q
tests/python/test_import.py
tests/python/test_ivf.py::test_save_load_roundtrip
tests/python/test_hnsw.py::test_save_load_roundtrip
tests/python/test_symqg.py::test_save_load_roundtrip
tests/python/test_qgkmeans.py::test_train_populates_faiss_style_outputs
tests/python/test_rabitqkmeans.py::test_flat_parameters_and_outputs
- name: Install FAISS comparison dependency
if: matrix.python-version == '3.11'
run: python -m pip install faiss-cpu
- name: Test comparison script
if: matrix.python-version == '3.11'
env:
OMP_NUM_THREADS: "2"
run: python -m pytest tests/python/test_compare_with_faiss.py --tb=short -q
python-result:
name: Python validation
needs: [changes, python-build]
if: ${{ always() }}
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Require selected Python versions
env:
CHANGES_RESULT: ${{ needs.changes.result }}
PYTHON_SELECTED: ${{ needs.changes.outputs.python_build }}
MATRIX_RESULT: ${{ needs.python-build.result }}
run: |
if [ "$CHANGES_RESULT" = success ] && [ "$PYTHON_SELECTED" = false ]; then
test "$MATRIX_RESULT" = skipped || test "$MATRIX_RESULT" = success
else
test "$MATRIX_RESULT" = success
fi
python-windows:
needs: changes
if: ${{ !cancelled() && (needs.changes.result != 'success' || needs.changes.outputs.python_build == 'true') }}
name: Python Windows x86-64 (VS 2026)
runs-on: windows-2025-vs2026
timeout-minutes: 45
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.11"
cache: pip
- name: Build and install package
run: python -m pip install ".[test]" -v
- name: Smoke-test source installation
run: >-
python -m pytest --tb=short -q
tests/python/test_import.py
tests/python/test_ivf.py::test_save_load_roundtrip
tests/python/test_hnsw.py::test_save_load_roundtrip
tests/python/test_symqg.py::test_save_load_roundtrip
tests/python/test_qgkmeans.py::test_train_populates_faiss_style_outputs
tests/python/test_rabitqkmeans.py::test_flat_parameters_and_outputs