Repository navigation
99 lines (87 loc) · 3.04 KB
/
Copy pathpython.yml
File metadata and controls
99 lines (87 loc) · 3.04 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
name: Python
on:
push:
branches: [main]
pull_request:
paths:
- '.github/workflows/python.yml'
- 'cmake/**'
- 'python/src/**'
- 'python/src/CMakeLists.txt'
- 'src/**'
- 'CMakeLists.txt'
- 'MANIFEST.in'
- 'pyproject.toml'
- 'setup.py'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
Build:
name: ${{ matrix.name }} Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ${{ github.event_name == 'pull_request' && fromJSON('["3.14"]') || fromJSON('["3.10", "3.11", "3.12", "3.13", "3.14"]') }}
include:
- os: ubuntu-latest
name: Linux
- os: windows-latest
name: Windows
- os: macOS-latest
name: macOS
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
fetch-depth: 10
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Ccache (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get install ccache
echo 'CACHE_PATH=~/.cache/ccache' >> "$GITHUB_ENV"
- name: Install Ccache (macOS)
if: runner.os == 'macOS'
run: |
brew install ccache
echo 'CACHE_PATH=~/Library/Caches/ccache' >> "$GITHUB_ENV"
- name: Install Ccache (Windows)
if: runner.os == 'Windows'
run: |
choco install ccache
"CACHE_PATH=${env:LOCALAPPDATA}\ccache" | Out-File -FilePath $env:GITHUB_ENV -Append
# On Linux, explicitly build for x86-64-v3 instead of -march=native. This
# avoids issues with ccache restoring from a runner with a different ISA.
- name: Check x86-64-v3 support (Linux)
if: runner.os == 'Linux'
run: |
for f in avx2 bmi1 bmi2 f16c fma abm movbe xsave; do
grep -qw "$f" /proc/cpuinfo || { echo "::error::Runner CPU lacks $f, which x86-64-v3 requires"; exit 1; }
done
echo "CPU: $(grep -m1 '^model name' /proc/cpuinfo | cut -d: -f2-)"
- name: Cache Build
id: cache-build
uses: actions/cache@v5
with:
path: ${{ env.CACHE_PATH }}
key: ${{ runner.os }}-Python${{ matrix.python-version }}-cache
- name: Prepare Ccache
run: |
ccache --max-size=1.0G
ccache -V && ccache --show-config
ccache --show-stats && ccache --zero-stats
- name: Build and Install
env:
CMAKE_ARGS: ${{ runner.os == 'Linux' && '-DSIMD_CXX_FLAGS=-march=x86-64-v3' || '' }}
run: |
pip install --verbose . && ccache --show-stats
- name: Tests
run: |
pip install -r python/tests/requirements.txt
nose2 -v --pretty-assert -s python/tests