-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (102 loc) · 3.88 KB
/
_build_linux_aarch64.yml
File metadata and controls
120 lines (102 loc) · 3.88 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
name: Build Linux aarch64 Wheels
on:
workflow_call:
jobs:
build-linux-aarch64:
name: Build Linux aarch64 Wheels
# Use native ARM64 runners for much faster builds (vs QEMU emulation)
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# Setup Go for BoringSSL build
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
cache: true
# Build wheels with cibuildwheel (handles manylinux containers)
# Vendor dependencies are built inside the manylinux container and cached across Python versions
# Note: GitHub Actions cache doesn't work here since vendor dir is inside the container
- name: Build wheels
uses: pypa/cibuildwheel@v3.3
env:
# Build for all Python versions on aarch64
CIBW_BUILD: cp38-manylinux_aarch64 cp39-manylinux_aarch64 cp310-manylinux_aarch64 cp311-manylinux_aarch64 cp312-manylinux_aarch64 cp313-manylinux_aarch64 cp314-manylinux_aarch64
# Vendor build happens inside manylinux container via before-build (from pyproject.toml)
# The script will detect cached libraries and skip rebuilding across Python versions
CIBW_ARCHS_LINUX: aarch64
# Setup Python versions for testing
- name: Setup Python versions
uses: actions/setup-python@v5
with:
python-version: |
3.8
3.9
3.10
3.11
3.12
3.13
3.14
allow-prereleases: true
# Test the built wheels on native ARM64
- name: Test wheels
run: |
# Test each wheel that was built
for wheel in ./wheelhouse/*.whl; do
echo "========================================"
echo "Testing wheel: $(basename "$wheel")"
echo "========================================"
# Extract Python version from wheel filename (e.g., cp39, cp310)
python_tag=$(basename "$wheel" | grep -oE 'cp[0-9]+' | head -1)
python_version="${python_tag:2:1}.${python_tag:3}"
echo "Setting up Python $python_version..."
# Try to find the matching Python version
python_cmd=""
for cmd in "python${python_version}" "python3.${python_version#*.}" "python3"; do
if command -v "$cmd" &> /dev/null; then
# Verify this is the right version
version_check=$($cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+' | head -1)
if [ "$version_check" = "$python_version" ]; then
python_cmd="$cmd"
break
fi
fi
done
# Fall back to python3 if we couldn't find exact match
if [ -z "$python_cmd" ]; then
echo "WARNING: Python $python_version not found, using python3"
python_cmd="python3"
fi
echo "Using Python: $($python_cmd --version)"
# Install the wheel in a fresh environment
"$python_cmd" -m pip install --force-reinstall "$wheel"
# Run the test script
echo ""
echo "Running tests..."
"$python_cmd" scripts/test_local_build.py
# Check exit code
if [ $? -eq 0 ]; then
echo ""
echo "[OK] Wheel test PASSED: $(basename "$wheel")"
else
echo ""
echo "[FAIL] Wheel test FAILED: $(basename "$wheel")"
exit 1
fi
echo ""
done
echo "========================================"
echo "All wheel tests PASSED"
echo "========================================"
# Upload wheels as artifacts
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux-aarch64
path: ./wheelhouse/*.whl
if-no-files-found: error
retention-days: 5
# Retry on transient failures
continue-on-error: false