Expose more system matrices #267
Workflow file for this run
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: Wheel builder and tester | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| - dev | |
| release: | |
| types: | |
| - published | |
| jobs: | |
| build_wheels: | |
| name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} ${{ matrix.buildplat[2] }} | |
| runs-on: ${{ matrix.buildplat[0] }} | |
| strategy: | |
| matrix: | |
| buildplat: | |
| # Not supported for now | |
| # - [ubuntu-22.04, musllinux, x86_64] | |
| # accelerate causes a segfault for some reason... | |
| # - [macos-13, macosx, x86_64, accelerate, "14.0"] | |
| # - [macos-14, macosx, arm64, accelerate, "14.0"] | |
| # working | |
| - [windows-2025, win, AMD64] | |
| - [ubuntu-22.04, manylinux, x86_64] | |
| - [macos-14, macosx, arm64, openblas, "12.3"] | |
| - [macos-15-intel, macosx, x86_64, openblas, "14.0"] | |
| python: [["cp39", "3.9"], ["cp310", "3.10"], ["cp311", "3.11"], ["cp312", "3.12"], ["cp313", "3.13"]] | |
| # python: [["cp312", "3.12"]] | |
| steps: | |
| - name: Checkout OptVL | |
| uses: actions/checkout@v4 | |
| # Used to host cibuildwheel | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| - name: win_amd64 - install rtools | |
| run: | | |
| # mingw-w64 | |
| choco install rtools -y --no-progress --force --version=4.0.0.20220206 | |
| echo "c:\rtools40\ucrt64\bin;" >> $env:GITHUB_PATH | |
| if: ${{ runner.os == 'Windows' }} | |
| - name: Setup macOS | |
| if: startsWith( matrix.buildplat[0], 'macos-' ) | |
| run: | | |
| if [[ ${{ matrix.buildplat[3] }} == 'accelerate' ]]; then | |
| echo CIBW_CONFIG_SETTINGS=\"setup-args=-Dblas=accelerate\" >> "$GITHUB_ENV" | |
| # Always use preinstalled gfortran for Accelerate builds | |
| ln -s $(which gfortran-13) gfortran | |
| export PATH=$PWD:$PATH | |
| echo "PATH=$PATH" >> "$GITHUB_ENV" | |
| LIB_PATH=$(dirname $(gfortran --print-file-name libgfortran.dylib)) | |
| fi | |
| # XCODE_VER='16.0' | |
| # CIBW="sudo xcode-select -s /Applications/Xcode_${XCODE_VER}.app" | |
| # echo "CIBW_BEFORE_ALL=$CIBW" >> $GITHUB_ENV | |
| # setting SDKROOT necessary when using the gfortran compiler | |
| # installed in cibw_before_build_macos.sh | |
| # sudo xcode-select -s /Applications/Xcode_${XCODE_VER}.app | |
| CIBW="MACOSX_DEPLOYMENT_TARGET=${{ matrix.buildplat[4] }}\ | |
| SDKROOT=$(xcrun --sdk macosx --show-sdk-path)\ | |
| PKG_CONFIG_PATH=${{ github.workspace }}" | |
| echo "CIBW_ENVIRONMENT=$CIBW" >> "$GITHUB_ENV" | |
| echo "REPAIR_PATH=$LIB_PATH" >> "$GITHUB_ENV" | |
| PREFIX=DYLD_LIBRARY_PATH="\$(dirname \$(gfortran --print-file-name libgfortran.dylib))" | |
| # remove libgfortran from location used for linking (if any), to | |
| # check wheel has bundled things correctly and all tests pass without | |
| # needing installed gfortran | |
| POSTFIX=" sudo rm -rf /opt/gfortran-darwin-x86_64-native &&\ | |
| sudo rm -rf /usr/local/gfortran/lib" | |
| CIBW="$PREFIX delocate-listdeps -d {wheel} && echo "-----------" &&\ | |
| $PREFIX delocate-wheel -v $EXCLUDE --require-archs \ | |
| {delocate_archs} -w {dest_dir} {wheel} && echo "-----------" &&\ | |
| delocate-listdeps -d {dest_dir}/*.whl && echo "-----------" &&\ | |
| $POSTFIX" | |
| # macos-arm64-openblas wheels that target macos-12 need a | |
| # MACOS_DEPLOYMENT_TARGET of 12.3 otherwise delocate complains. | |
| # Unclear of cause, possibly build tool related. | |
| # This results in wheels that have 12_3 in their name. Since Python | |
| # has no concept of minor OS versions in packaging land rename the | |
| # wheel back to 12. | |
| if [[ ${{ matrix.buildplat[0] }} == 'macos-14' && ${{ matrix.buildplat[4] }} == '12.3' ]]; then | |
| CIBW+=" && echo \$(ls {dest_dir}) && \ | |
| mv {dest_dir}/*.whl \$(find {dest_dir} -type f -name '*.whl' | sed 's/12_3/12_0/')" | |
| fi | |
| echo "CIBW_REPAIR_WHEEL_COMMAND_MACOS=$CIBW" >> "$GITHUB_ENV" | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v3.2.1 | |
| env: | |
| CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}* | |
| CIBW_ARCHS: ${{ matrix.buildplat[2] }} | |
| CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS | |
| - uses: actions/upload-artifact@v4 | |
| name: upload the wheels | |
| with: | |
| path: ./wheelhouse/*.whl | |
| name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }} | |
| ${{ matrix.buildplat[2] }} ${{ matrix.buildplat[3] }} | |
| ${{ matrix.buildplat[4] }} | |
| upload_all: | |
| name: upload the wheels to PYPI | |
| needs: [build_wheels] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: what is going on | |
| run: pwd & ls -R | |
| - name: Checkout OptVL | |
| uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| id: download | |
| name: download the wheels | |
| with: | |
| path: wheelhouse | |
| - name: 'Echo download path' | |
| run: echo ${{steps.download.outputs.download-path}} | |
| - name: Display structure of downloaded files | |
| run: ls -R | |
| - name: make dist dir | |
| run: mkdir dist | |
| - name: Move wheels to dist | |
| run: bash tools/wheels/move_wheels.sh | |
| - name: Publish distribution 📦 to PyPI | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| # packages-dir: wheelhouse/ | |
| skip-existing: true | |
| password: ${{ secrets.PYPI_API_TOKEN }} |