Bump microsoft/setup-msbuild from 2 to 3 #338
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build wheels | |
| on: [push, pull_request] | |
| jobs: | |
| build_sdist: | |
| name: Build source | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@master | |
| with: | |
| submodules: 'recursive' | |
| - uses: actions/setup-python@v6 | |
| name: Install Python | |
| with: | |
| python-version: '3.12' | |
| - name: Build source | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist --outdir=wheelhouse | |
| - name: Upload sdist to github | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-sdist | |
| path: wheelhouse/*.tar.gz | |
| if-no-files-found: error | |
| build_wheels: | |
| name: Build wheel on ${{ matrix.os }} for ${{ matrix.cibw_archs }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| cibw_archs: "x86_64" | |
| - os: ubuntu-24.04-arm | |
| cibw_archs: "aarch64" | |
| - os: windows-2022 | |
| cibw_archs: "auto64" | |
| cmake_gen_platform: "x64" | |
| - os: windows-11-arm | |
| cibw_archs: "ARM64" | |
| cmake_gen_platform: "ARM64" | |
| # Include macos-15-intel to get Intel x86_64 macs and macos-latest to get the Aarch64 macs | |
| - os: macos-15-intel | |
| cibw_archs: "x86_64" | |
| - os: macos-latest | |
| cibw_archs: "arm64" | |
| steps: | |
| - uses: actions/checkout@master | |
| with: | |
| submodules: 'recursive' | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v3 | |
| if: startsWith(matrix.os,'windows') | |
| - name: Add Windows SDK | |
| shell: cmd | |
| if: startsWith(matrix.os,'windows') | |
| run: | | |
| choco install windows-sdk-8.1 | |
| - uses: actions/setup-python@v6 | |
| name: Install Python | |
| with: | |
| python-version: '3.12' | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.3.1 | |
| env: | |
| CIBW_ENABLE: cpython-freethreading | |
| CIBW_BUILD: "cp3*" | |
| CIBW_ARCHS: ${{ matrix.cibw_archs }} | |
| # Numpy is not built for Windows ARM64 on Python <3.11 | |
| CIBW_SKIP: "*-win32 *-manylinux_i686 *-musllinux_* cp39-win_arm64 cp310-win_arm64" | |
| CIBW_TEST_REQUIRES: "pytest" | |
| CIBW_TEST_COMMAND: "pytest {project}/tests" | |
| # Skip testing on arm64 Python 3.8 because it uses the x86_64 executable, not the arm executable | |
| CIBW_TEST_SKIP: "cp38-macosx_*:arm64" | |
| # Clean the build directory between builds | |
| CIBW_BEFORE_BUILD: >- | |
| rm -rf {package}/c/build | |
| CIBW_ENVIRONMENT_LINUX: CMAKE_GENERATOR="Unix Makefiles" | |
| CIBW_ENVIRONMENT_MACOS: CMAKE_GENERATOR="Unix Makefiles" CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw_archs }} | |
| CIBW_ENVIRONMENT_WINDOWS: CMAKE_GENERATOR="Visual Studio 17 2022" CMAKE_GENERATOR_PLATFORM=${{ matrix.cmake_gen_platform }} | |
| CIBW_BUILD_VERBOSITY: 1 | |
| - name: Upload artifacts to github | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ runner.os }}-${{ matrix.cibw_archs }} | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish_to_pypi: | |
| name: Publish wheels to PyPi | |
| if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
| needs: [build_sdist, build_wheels] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Print out packages | |
| run: ls -la dist/* | |
| - name: Upload wheels to pypi | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.pypi_password }} | |
| # Need to ensure both twine and packaging are updated to twine 6.2+ and packaging 25+ | |
| # to work around https://github.com/pypa/twine/issues/1216 | |
| run: | | |
| python -m pip install --upgrade packaging | |
| python -m pip install --upgrade twine | |
| twine upload dist/* |