name: Build Wheels, Test and Release on: push: branches: - master - 'buildwheels*' tags: - 'v*' - 'buildwheels*' pull_request: jobs: build_linux_wheels: name: Build ${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ubuntu-22.04] cibw_python: ["cp310", "cp311", "cp312", "cp313", "pp310"] # SciPy and NumPy don't support musllinux cibw_libc: ["manylinux"] cibw_arch: ["x86_64", "aarch64"] exclude: # Numpy only supports pypy39 x86_64 on Linux - cibw_python: "pp310" cibw_arch: "aarch64" steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.13' - name: Set up QEMU uses: docker/setup-qemu-action@v3 with: platforms: arm64 - name: Install cibuildwheel run: | python -m pip install cibuildwheel - name: Build the wheel run: | python -m cibuildwheel --output-dir dist env: CIBW_BUILD: ${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }} - uses: actions/upload-artifact@v4 name: Upload wheels as artifacts if: ${{ github.event_name != 'pull_request' }} with: name: wheels-${{ matrix.cibw_python }}-${{ matrix.cibw_libc }}_${{ matrix.cibw_arch }} path: ./dist/*.whl build_macos_wheels: name: Build ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-12] cibw_python: ["cp310", "cp311", "cp312", "cp313", "pp310"] cibw_arch: ["x86_64"] env: MACOSX_DEPLOYMENT_TARGET: "12.0" steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install FFTW3 libraries run: | brew install fftw - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.13' - name: Install cibuildwheel run: | python -m pip install cibuildwheel - name: Build wheels for CPython (MacOS) run: | python -m cibuildwheel --output-dir dist env: CIBW_BUILD: ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} - uses: actions/upload-artifact@v4 name: Upload wheels as artifacts if: ${{ github.event_name != 'pull_request' }} with: name: wheels-${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} path: ./dist/*.whl build_macos_arm64_wheels: name: Build ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-14] cibw_python: ["cp310", "cp311", "cp312", "cp313"] cibw_arch: ["arm64"] env: MACOSX_DEPLOYMENT_TARGET: "14.0" steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install FFTW3 libraries run: | brew install fftw - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.13' - name: Install cibuildwheel run: | python -m pip install cibuildwheel - name: Build wheels for CPython (MacOS) run: | python -m cibuildwheel --output-dir dist env: CIBW_BUILD: ${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} - uses: actions/upload-artifact@v4 name: Upload wheels as artifacts if: ${{ github.event_name != 'pull_request' }} with: name: wheels-${{ matrix.cibw_python }}-macosx_${{ matrix.cibw_arch }} path: ./dist/*.whl build_windows_wheels: name: Build ${{ matrix.cibw_python }}-win${{ matrix.cibw_arch }} wheel on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [windows-2022] cibw_python: ["cp310", "cp311", "cp312", "cp313", "pp310"] # Add arm64 when we support it cibw_arch: ["_amd64", "32"] exclude: # cibuildwheel only supports pypy310 AMD64 on Windows - cibw_python: "pp310" cibw_arch: "32" steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.13' - name: Install cibuildwheel run: | python -m pip install cibuildwheel - name: Download FFTW libraries run: | Write-Output "Downloading FFTW release (64-bit)" Invoke-WebRequest -Uri "https://fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" -OutFile "${{ github.workspace }}\fftw64.zip" Write-Output "Unzipping 64-bit FFTW release" Expand-Archive -Path "${{ github.workspace }}\fftw64.zip" -DestinationPath "${{ github.workspace }}\fftw64" Write-Output "Downloading FFTW release (32-bit)" Invoke-WebRequest -Uri "https://fftw.org/pub/fftw/fftw-3.3.5-dll32.zip" -OutFile "${{ github.workspace }}\fftw32.zip" Write-Output "Unzipping 32-bit FFTW release" Expand-Archive -Path "${{ github.workspace }}\fftw32.zip" -DestinationPath "${{ github.workspace }}\fftw32" shell: powershell # Annoyingly these two next steps are needed as FFTW does not ship with # .lib files which msvc requires for linking - name: Setup Visual Code build tools (32-bit) uses: ilammy/msvc-dev-cmd@v1 with: arch: x86 if: ${{ matrix.cibw_arch == '32' }} - name: Setup Visual Code build tools (64-bit) uses: ilammy/msvc-dev-cmd@v1 with: arch: amd64 if: ${{ matrix.cibw_arch != '32' }} - name: Convert .def files to .lib run: | lib.exe /def:${{ github.workspace }}\fftw64\libfftw3-3.def /out:${{ github.workspace }}\fftw64\libfftw3-3.lib /machine:x64 lib.exe /def:${{ github.workspace }}\fftw64\libfftw3f-3.def /out:${{ github.workspace }}\fftw64\libfftw3f-3.lib /machine:x64 lib.exe /def:${{ github.workspace }}\fftw64\libfftw3l-3.def /out:${{ github.workspace }}\fftw64\libfftw3l-3.lib /machine:x64 lib.exe /def:${{ github.workspace }}\fftw32\libfftw3-3.def /out:${{ github.workspace }}\fftw32\libfftw3-3.lib /machine:x86 lib.exe /def:${{ github.workspace }}\fftw32\libfftw3f-3.def /out:${{ github.workspace }}\fftw32\libfftw3f-3.lib /machine:x86 lib.exe /def:${{ github.workspace }}\fftw32\libfftw3l-3.def /out:${{ github.workspace }}\fftw32\libfftw3l-3.lib /machine:x86 - name: Build Windows wheels env: ARCHITECTURE_BIT: ${{ matrix.cibw_arch == '32' && '32' || '64' }} CIBW_BUILD: ${{ matrix.cibw_python }}-win${{ matrix.cibw_arch }} CIBW_BEFORE_BUILD: >- (robocopy ${{ github.workspace }}\fftw${{ matrix.cibw_arch == '32' && '32' || '64' }} ${{ github.workspace }}\pyfftw /V /S /E) ^& exit 0 run: | python -m cibuildwheel --output-dir dist - uses: actions/upload-artifact@v4 name: Upload wheels as artifacts if: ${{ github.event_name != 'pull_request' }} with: name: wheels-${{ matrix.cibw_python }}-win${{ matrix.cibw_arch }} path: ./dist/*.whl deploy: name: Release needs: [build_linux_wheels, build_macos_wheels, build_windows_wheels] if: github.repository_owner == 'pyFFTW' && startsWith(github.ref, 'refs/tags/v') && always() runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 name: Install Python with: python-version: '3.13' - name: Install Twine and Build run: | python -m pip install --upgrade pip pip install twine build - uses: actions/download-artifact@v4 id: download with: path: ./dist merge-multiple: true - name: Publish the source distribution on PyPI run: | PYFFTW_VERSION=$(git describe --tags) python -m build --sdist ls -la ${{ github.workspace }}/dist # We prefer to release wheels before source because otherwise there is a # small window during which users who pip install pyfftw will require compilation. twine upload ${{ github.workspace }}/dist/*.whl twine upload ${{ github.workspace }}/dist/pyfftw-${PYFFTW_VERSION:1}.tar.gz env: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - name: Github release uses: softprops/action-gh-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_REPOSITORY: ${{ github.repository }}