Repository navigation
151 lines (133 loc) · 5.33 KB
/
Copy pathpython.yml
File metadata and controls
151 lines (133 loc) · 5.33 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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 pyyaml
- 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
# Release wheel jobs build and fully test the oldest and newest ABIs on every PR, so
# one source build covers typing, editor metadata and source-installation smoke tests.
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
- uses: actions/setup-node@v7
with:
node-version: "24"
package-manager-cache: false
- name: Verify runner CMake
run: cmake --version
- name: Upgrade pip
run: pip install --upgrade pip
- name: Build and install wheel
run: pip install ".[test,typing]" -v
# PR wheels own mypy and the full editor suite. Non-release branch pushes
# may skip wheels, so source installs must retain those checks on pushes.
- name: Check source-installed Python declarations
if: github.event_name == 'pull_request'
run: python -m pytest tests/python/test_editor_support.py::test_installed_public_declarations --tb=short -q
- name: Check installed Python types and editor metadata on pushes
if: github.event_name == 'push'
env:
OMP_NUM_THREADS: "2"
run: python -m pytest tests/python/test_editor_support.py tests/test_mypy.py --tb=short -q
- name: Check Pyright public API and test code
run: python -m pytest tests/test_pyright.py --tb=short -q
# 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
run: python -m pip install faiss-cpu
- name: Test comparison script
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