CI: more macOS CI changes #76
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: | |
| branches: | |
| - master | |
| tags: | |
| - '*' | |
| concurrency: | |
| group: wheels-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_wheels: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-13, macos-14] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 # Fetch all history for DiscoverVersion | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.21 | |
| env: | |
| CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*" | |
| CIBW_SKIP: "*-musllinux_* *-manylinux_i686 *-win32" | |
| # Install system dependencies - Linux | |
| CIBW_BEFORE_ALL_LINUX: "yum install -y lapack-devel || (apt-get update && apt-get install -y gfortran liblapack-dev)" | |
| # Install system dependencies - macOS | |
| CIBW_BEFORE_ALL_MACOS: > | |
| brew install gcc lapack && | |
| GFORTRAN=$(ls $(brew --prefix gcc)/bin/gfortran-* | head -1) && | |
| ln -sf $GFORTRAN /usr/local/bin/gfortran && | |
| gfortran --version | |
| # Install system dependencies - Windows (MSYS2 with MinGW-w64) | |
| CIBW_BEFORE_ALL_WINDOWS: >- | |
| C:\\msys64\\usr\\bin\\bash -lc "pacman --noconfirm -Syu" && | |
| C:\\msys64\\usr\\bin\\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-gcc-fortran mingw-w64-x86_64-openblas" | |
| # Environment - macOS | |
| CIBW_ENVIRONMENT_MACOS: "FC=gfortran PKG_CONFIG_PATH=$(brew --prefix lapack)/lib/pkgconfig:$(brew --prefix openblas)/lib/pkgconfig MACOSX_DEPLOYMENT_TARGET=14.0" | |
| # Environment - Windows | |
| CIBW_ENVIRONMENT_WINDOWS: >- | |
| PATH="C:\\msys64\\mingw64\\bin;$PATH" | |
| FC="C:\\msys64\\mingw64\\bin\\gfortran.exe" | |
| CC="C:\\msys64\\mingw64\\bin\\gcc.exe" | |
| CXX="C:\\msys64\\mingw64\\bin\\g++.exe" | |
| LIBRARY_PATH="C:\\msys64\\mingw64\\lib" | |
| PKG_CONFIG_PATH="C:\\msys64\\mingw64\\lib\\pkgconfig" | |
| # Build dependencies | |
| CIBW_BUILD_FRONTEND: "build" | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| - name: Release wheels | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: wheelhouse/*.whl | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check tag | |
| id: check-tag | |
| run: | | |
| if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo ::set-output name=match::true | |
| fi | |
| shell: bash | |
| - name: Deploy to PyPI | |
| if: steps.check-tag.outputs.match == 'true' | |
| run: | | |
| pip install twine | |
| twine upload wheelhouse/*.whl | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| shell: bash |