-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (143 loc) · 5.3 KB
/
build-wheels.yml
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
152
153
154
155
156
157
158
159
160
161
162
163
164
name: build-wheels
on:
workflow_run:
workflows: ["run-tests"]
types:
- completed
branches: [main]
jobs:
build-macos-wheels:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Build wheels on ${{ matrix.os }}-cp${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "pybind11[global]"
pip install cibuildwheel
- name: Build wheels
run: |
PYTHON_VERSION=$(echo "${{ matrix.python }}" | tr -d '.')
export CIBW_BUILD="cp${PYTHON_VERSION}-*"
echo "CIBW_BUILD: $CIBW_BUILD"
python -m cibuildwheel
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_SKIP: "*-win32 *-manylinux_i686 pp*"
- name: Store the wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.python }}
path: ./wheelhouse/*.whl
compression-level: 0
- name: List uploaded artifacts
run: |
pwd
echo "Current directory contents:"
ls -R ./wheelhouse/
build-win-wheels:
name: Build wheels on ${{ matrix.os }}-cp${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install "pybind11[global]"
pip install cibuildwheel
- name: Build wheels
shell: pwsh
run: |
# Set Python version for CIBW_BUILD
$PYTHON_VERSION = "${{ matrix.python }}" -replace '\.'
$env:CIBW_BUILD = "cp${PYTHON_VERSION}-*"
Write-Host "CIBW_BUILD: $env:CIBW_BUILD"
python -m cibuildwheel
env:
CIBW_BUILD_VERBOSITY: 1
CIBW_SKIP: "*-win32 *-manylinux* *-musllinux* pp*"
# Add these test configurations
CIBW_TEST_REQUIRES: pybind11
CIBW_TEST_COMMAND: "python -c \"import ember; from ember.aten import Tensor; print('Import successful')\""
- name: Store the wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-${{ matrix.python }}
path: .\wheelhouse\*.whl
compression-level: 0
# Add this test step before listing artifacts
- name: Test built wheel
shell: pwsh
run: |
pip uninstall pyember -y
pip install (Get-Item .\wheelhouse\*.whl)
python -c "import ember; from ember.aten import Tensor; print('Test import successful'); print(ember.__file__)"
- name: List uploaded artifacts
shell: pwsh
run: |
Write-Host "Current directory contents:"
Get-ChildItem -Recurse .\wheelhouse\
build-linux-wheels:
name: Build wheels on manylinux2_28-cp${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Build wheel in manylinux container
uses: addnab/docker-run-action@v3
with:
image: quay.io/pypa/manylinux_2_28_x86_64
options: -v ${{ github.workspace }}:/work
run: |
# Install Python development files
yum install -y python3-devel epel-release
yum install -y python${{ matrix.python }}-devel
# Set up Python paths
PYTHON_VERSION=$(echo "${{ matrix.python }}" | tr -d '.')
PYSHORT="${{ matrix.python }}"
export PYROOT="/opt/python/cp${PYTHON_VERSION}-cp${PYTHON_VERSION}"
export PATH="${PYROOT}/bin:$PATH"
# Install build dependencies
${PYROOT}/bin/python -m pip install --upgrade pip
${PYROOT}/bin/pip install "pybind11[global]"
${PYROOT}/bin/pip install build auditwheel
# Build the wheel
cd /work
mkdir -p wheelhouse
${PYROOT}/bin/python -m build --wheel --outdir /tmp/dist/
# Repair the wheel to make it manylinux compatible
auditwheel repair --plat manylinux_2_28_x86_64 /tmp/dist/*.whl -w /work/wheelhouse/
# test the built wheel
${PYROOT}/bin/pip install /work/wheelhouse/*.whl
${PYROOT}/bin/python -c "import ember; print(ember.__file__)"
- name: Store the wheels
uses: actions/upload-artifact@v4
with:
name: wheels-manylinux-${{ matrix.python }}
path: ./wheelhouse/*.whl
compression-level: 0
- name: List uploaded artifacts
run: |
pwd
echo "Current directory contents:"
ls -R ./wheelhouse/