-
-
Notifications
You must be signed in to change notification settings - Fork 14
181 lines (152 loc) · 4.94 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: Build_Wheels
on:
pull_request:
paths:
- "**.py"
- "**.pxd"
- "**.pyx"
- "**"
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read # to fetch code (actions/checkout)
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os[1] }} - ${{ matrix.os[2] }} with Python ${{ matrix.python[0] }}
runs-on: ${{ matrix.os[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
os: # see scipy wheels.yml GH actions
- [ubuntu-22.04, manylinux, x86_64]
- [macos-12, macosx, x86_64]
# - [macos-12, macosx_*, arm64]
- [windows-2019, win, AMD64]
# python[0] is used to specify the python versions made by cibuildwheel
python:
[
["cp39", "3.9"],
["cp310", "3.10"],
["cp311", "3.11"],
["cp312", "3.12"],
]
env:
IS_32_BIT: ${{ matrix.os[2] == 'x86' }}
steps:
- name: Checkout treeple
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Setup submodule
run: |
python -m pip install --upgrade pip spin
python -m spin setup-submodule
- name: win_amd64 - install rtools
run: |
choco install rtools -y --no-progress --force --version=4.0.0.20220206
echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH
if: ${{ runner.os == 'Windows' && env.IS_32_BIT == 'false' }}
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.2
# Build all wheels here, apart from macosx_arm64, linux_aarch64
# cibuildwheel is currently unable to pass configuration flags to
# CIBW_BUILD_FRONTEND https://github.com/pypa/cibuildwheel/issues/1227
# (pip/build). Cross compilation with meson requires an initial
# configuration step to create a build directory. The subsequent wheel
# build then needs to use that directory. This can be done with pip
# using a command like:
# pip wheel --config-settings builddir=build .
# if: >-
# ( ! contains(matrix.os[2], 'arm64' ) )
env:
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.os[1] }}*
CIBW_ARCHS: ${{ matrix.os[2] }}
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse/
name: ${{ matrix.python[0] }}-${{ matrix.os[1] }}
build-wheels-m1:
name: Build wheels on Arm M1 with Python ${{ matrix.python[0] }}
runs-on: macos-latest
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# python[0] is used to specify the python versions made by cibuildwheel
python:
[
["cp39", "3.9"],
["cp310", "3.10"],
["cp311", "3.11"],
["cp312", "3.12"],
]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10" # Replace with the desired Python version
- name: Install cibuildwheel dependencies
run: |
pip install cibuildwheel
pip install spin
spin setup-submodule
pip install .[build]
- name: Build wheels
uses: pypa/cibuildwheel@v2.21.2
env:
CIBW_BUILD: ${{ matrix.python[0] }}-macosx_arm64
CIBW_ARCHS_MACOS: arm64
- uses: actions/upload-artifact@v4
with:
path: ./wheelhouse
name: ${{ matrix.python[0] }}-arm
# Build the source distribution under Linux
build_sdist:
name: Source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout treeple
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Build source distribution
run: |
pip install spin build
spin setup-submodule
pip install .[build]
python -m build --sdist
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.python[0] }}-${{ matrix.os[1] }}
path: dist
merge-wheels:
name: Merge all wheels into one directory
needs: [build_wheels, build-wheels-m1, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: all
- name: List all files
run: |
ls all/**
- name: Merge files
run: |
mkdir dist
mv all/**/*.whl ./dist
mv all/**/*.tar.gz ./dist
- uses: actions/upload-artifact@v4
with:
path: dist
name: dist