Debian Codegraph @

.github/workflows/wheel_tests_and_release.yml

raw
1 name: Build Wheels, Test and Release
2
3 on:
4 push:
5 branches:
6 - master
7 - 'buildwheels*'
8
9 tags:
10 - 'v*'
11 - 'buildwheels*'
12
13 pull_request:
14
15 jobs:
16 build_linux_wheels:
17 name: Build ${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }}
18 runs-on: ${{ matrix.os }}
19 strategy:
20 fail-fast: false
21 matrix:
22 os: [ubuntu-22.04]
23 cibw_python: ["cp310", "cp311", "cp312", "cp313", "pp310"]
24 # SciPy and NumPy don't support musllinux
25 cibw_libc: ["manylinux"]
26 cibw_arch: ["x86_64", "aarch64"]
27
28 exclude:
29 # Numpy only supports pypy39 x86_64 on Linux
30 - cibw_python: "pp310"
31 cibw_arch: "aarch64"
32
33 steps:
34 - uses: actions/checkout@v4
35 with:
36 fetch-depth: 0
37
38 - uses: actions/setup-python@v5
39 name: Install Python
40 with:
41 python-version: '3.13'
42
43 - name: Set up QEMU
44 uses: docker/setup-qemu-action@v3
45 with:
46 platforms: arm64
47
48 - name: Install cibuildwheel
49 run: |
50 python -m pip install cibuildwheel
51
52 - name: Build the wheel
53 run: |
54 python -m cibuildwheel --output-dir dist
55 env:
56 CIBW_BUILD: ${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }}
57
58 - uses: actions/upload-artifact@v4
59 name: Upload wheels as artifacts
60 if: ${{ github.event_name != 'pull_request' }}
61 with:
62 name: wheels-${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }}
63 path: ./dist/*.whl
64
65
66 build_macos_wheels:
67 name: Build ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }}
68 runs-on: ${{ matrix.os }}
69 strategy:
70 fail-fast: false
71 matrix:
72 os: [macos-12]
73 cibw_python: ["cp310", "cp311", "cp312", "cp313", "pp310"]
74 cibw_arch: ["x86_64"]
75
76 env:
77 MACOSX_DEPLOYMENT_TARGET: "12.0"
78 steps:
79 - uses: actions/checkout@v4
80 with:
81 fetch-depth: 0
82
83 - name: Install FFTW3 libraries
84 run: |
85 brew install fftw
86
87 - uses: actions/setup-python@v5
88 name: Install Python
89 with:
90 python-version: '3.13'
91
92 - name: Install cibuildwheel
93 run: |
94 python -m pip install cibuildwheel
95
96 - name: Build wheels for CPython (MacOS)
97 run: |
98 python -m cibuildwheel --output-dir dist
99 env:
100 CIBW_BUILD: ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }}
101
102 - uses: actions/upload-artifact@v4
103 name: Upload wheels as artifacts
104 if: ${{ github.event_name != 'pull_request' }}
105 with:
106 name: wheels-${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }}
107 path: ./dist/*.whl
108
109
110 build_macos_arm64_wheels:
111 name: Build ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }}
112 runs-on: ${{ matrix.os }}
113 strategy:
114 fail-fast: false
115 matrix:
116 os: [macos-14]
117 cibw_python: ["cp310", "cp311", "cp312", "cp313"]
118 cibw_arch: ["arm64"]
119
120 env:
121 MACOSX_DEPLOYMENT_TARGET: "14.0"
122 steps:
123 - uses: actions/checkout@v4
124 with:
125 fetch-depth: 0
126
127 - name: Install FFTW3 libraries
128 run: |
129 brew install fftw
130
131 - uses: actions/setup-python@v5
132 name: Install Python
133 with:
134 python-version: '3.13'
135
136 - name: Install cibuildwheel
137 run: |
138 python -m pip install cibuildwheel
139
140 - name: Build wheels for CPython (MacOS)
141 run: |
142 python -m cibuildwheel --output-dir dist
143 env:
144 CIBW_BUILD: ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }}
145
146 - uses: actions/upload-artifact@v4
147 name: Upload wheels as artifacts
148 if: ${{ github.event_name != 'pull_request' }}
149 with:
150 name: wheels-${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }}
151 path: ./dist/*.whl
152
153
154 build_windows_wheels:
155 name: Build ${{ matrix.cibw_python }}-win${{ matrix.cibw_arch }} wheel on ${{ matrix.os }}
156 runs-on: ${{ matrix.os }}
157 strategy:
158 fail-fast: false
159 matrix:
160 os: [windows-2022]
161 cibw_python: ["cp310", "cp311", "cp312", "cp313", "pp310"]
162 # Add arm64 when we support it
163 cibw_arch: ["_amd64", "32"]
164
165 exclude:
166 # cibuildwheel only supports pypy310 AMD64 on Windows
167 - cibw_python: "pp310"
168 cibw_arch: "32"
169
170 steps:
171 - uses: actions/checkout@v4
172 with:
173 fetch-depth: 0
174
175 - uses: actions/setup-python@v5
176 name: Install Python
177 with:
178 python-version: '3.13'
179
180 - name: Install cibuildwheel
181 run: |
182 python -m pip install cibuildwheel
183
184 - name: Download FFTW libraries
185 run: |
186 Write-Output "Downloading FFTW release (64-bit)"
187 Invoke-WebRequest -Uri "https://fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" -OutFile "${{ github.workspace }}\fftw64.zip"
188 Write-Output "Unzipping 64-bit FFTW release"
189 Expand-Archive -Path "${{ github.workspace }}\fftw64.zip" -DestinationPath "${{ github.workspace }}\fftw64"
190
191 Write-Output "Downloading FFTW release (32-bit)"
192 Invoke-WebRequest -Uri "https://fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" -OutFile "${{ github.workspace }}\fftw32.zip"
193 Write-Output "Unzipping 32-bit FFTW release"
194 Expand-Archive -Path "${{ github.workspace }}\fftw32.zip" -DestinationPath "${{ github.workspace }}\fftw32"
195
196 shell: powershell
197
198 # Annoyingly these two next steps are needed as FFTW does not ship with
199 # .lib files which msvc requires for linking
200 - name: Setup Visual Code build tools (32-bit)
201 uses: ilammy/msvc-dev-cmd@v1
202 with:
203 arch: x86
204 if: ${{ matrix.cibw_arch == '32' }}
205
206 - name: Setup Visual Code build tools (64-bit)
207 uses: ilammy/msvc-dev-cmd@v1
208 with:
209 arch: amd64
210 if: ${{ matrix.cibw_arch != '32' }}
211
212 - name: Convert .def files to .lib
213 run: |
214 lib.exe /def:${{ github.workspace }}\fftw64\libfftw3-3.def /out:${{ github.workspace }}\fftw64\libfftw3-3.lib /machine:x64
215 lib.exe /def:${{ github.workspace }}\fftw64\libfftw3f-3.def /out:${{ github.workspace }}\fftw64\libfftw3f-3.lib /machine:x64
216 lib.exe /def:${{ github.workspace }}\fftw64\libfftw3l-3.def /out:${{ github.workspace }}\fftw64\libfftw3l-3.lib /machine:x64
217
218 lib.exe /def:${{ github.workspace }}\fftw32\libfftw3-3.def /out:${{ github.workspace }}\fftw32\libfftw3-3.lib /machine:x86
219 lib.exe /def:${{ github.workspace }}\fftw32\libfftw3f-3.def /out:${{ github.workspace }}\fftw32\libfftw3f-3.lib /machine:x86
220 lib.exe /def:${{ github.workspace }}\fftw32\libfftw3l-3.def /out:${{ github.workspace }}\fftw32\libfftw3l-3.lib /machine:x86
221
222 - name: Build Windows wheels
223 env:
224 ARCHITECTURE_BIT: ${{ matrix.cibw_arch == '32' && '32' || '64' }}
225 CIBW_BUILD: ${{ matrix.cibw_python }}-win${{ matrix.cibw_arch }}
226 CIBW_BEFORE_BUILD: >-
227 (robocopy
228 ${{ github.workspace }}\fftw${{ matrix.cibw_arch == '32' && '32' || '64' }}
229 ${{ github.workspace }}\pyfftw /V /S /E)
230 ^& exit 0
231 run: |
232 python -m cibuildwheel --output-dir dist
233
234 - uses: actions/upload-artifact@v4
235 name: Upload wheels as artifacts
236 if: ${{ github.event_name != 'pull_request' }}
237 with:
238 name: wheels-${{ matrix.cibw_python }}-win${{ matrix.cibw_arch }}
239 path: ./dist/*.whl
240
241
242 deploy:
243 name: Release
244 needs: [build_linux_wheels, build_macos_wheels, build_windows_wheels]
245 if: github.repository_owner == 'pyFFTW' && startsWith(github.ref, 'refs/tags/v') && always()
246 runs-on: ubuntu-latest
247 steps:
248 - uses: actions/checkout@v4
249 with:
250 fetch-depth: 0
251 - uses: actions/setup-python@v5
252 name: Install Python
253 with:
254 python-version: '3.13'
255
256 - name: Install Twine and Build
257 run: |
258 python -m pip install --upgrade pip
259 pip install twine build
260
261 - uses: actions/download-artifact@v4
262 id: download
263 with:
264 path: ./dist
265 merge-multiple: true
266
267 - name: Publish the source distribution on PyPI
268 run: |
269 PYFFTW_VERSION=$(git describe --tags)
270 python -m build --sdist
271 ls -la ${{ github.workspace }}/dist
272 # We prefer to release wheels before source because otherwise there is a
273 # small window during which users who pip install pyfftw will require compilation.
274 twine upload ${{ github.workspace }}/dist/*.whl
275 twine upload ${{ github.workspace }}/dist/pyfftw-${PYFFTW_VERSION:1}.tar.gz
276 env:
277 TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
278 TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
279
280 - name: Github release
281 uses: softprops/action-gh-release@v1
282 env:
283 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
284 GITHUB_REPOSITORY: ${{ github.repository }}