diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml index 54232e39..88cdc2c6 100644 --- a/.github/workflows/macos.yaml +++ b/.github/workflows/macos.yaml @@ -31,6 +31,8 @@ on: jobs: ci: runs-on: macos-13 + env: + CMAKE_OSX_DEPLOYMENT_TARGET: "13.0" strategy: matrix: python-version: diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index b0e1ed6f..1cf528c5 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -68,7 +68,7 @@ jobs: LD_LIBRARY_PATH=/project/.nox/.cache/libbezier-release/usr/lib TARGET_NATIVE_ARCH=OFF CIBW_TEST_COMMAND: pytest {project}/tests/unit - CIBW_TEST_REQUIRES: pytest + CIBW_TEST_REQUIRES: "pytest scipy sympy" CIBW_SKIP: "*musllinux*" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 @@ -76,10 +76,8 @@ jobs: name: ${{ matrix.artifact-name }} path: ./wheelhouse/*.whl - macos-intel: - # NOTE: For now `scripts/macos/build-wheels-arm.sh` must be used for - # the ARM (M1) wheels. - runs-on: macos-13 + macos-arm64: + runs-on: macos-14 steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -102,21 +100,72 @@ jobs: nox --session libbezier-release - name: Build wheels - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf #v2.19.1 + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 env: BEZIER_INSTALL_PREFIX: ./.nox/.cache/libbezier-release/usr + CIBW_ARCHS: arm64 CIBW_BEFORE_BUILD: | python -m pip install numpy CIBW_BUILD: >- cp310-* cp311-* cp312-* + CIBW_ENVIRONMENT: >- + MACOSX_DEPLOYMENT_TARGET=14.0 CIBW_TEST_COMMAND: pytest {project}/tests/unit - CIBW_TEST_REQUIRES: pytest + CIBW_TEST_REQUIRES: "pytest scipy sympy" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: - name: macos-intel + name: macos-arm64 + path: ./wheelhouse/*.whl + + macos-x86-64: + runs-on: macos-14 + + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + with: + python-version: "3.12" + + - name: Install `homebrew` in x86_64 arch + run: | + arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + + - name: Install `gcc` in x86_64 `homebrew + run: | + arch -x86_64 /usr/local/bin/brew install gcc + + - name: Build `libbezier` + env: + TARGET_NATIVE_ARCH: "OFF" + # NOTE: Could also use $(brew --prefix gcc)/bin/gfortran + CMAKE_FORTRAN_COMPILER: /usr/local/bin/gfortran + run: | + python3.12 -m pip install cmake nox + nox --session libbezier-release + + - name: Build wheels + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 + env: + BEZIER_INSTALL_PREFIX: ./.nox/.cache/libbezier-release/usr + CIBW_ARCHS: x86_64 + CIBW_BEFORE_BUILD: | + python -m pip install numpy + CIBW_BUILD: >- + cp310-* + cp311-* + cp312-* + CIBW_ENVIRONMENT: >- + MACOSX_DEPLOYMENT_TARGET=14.0 + CIBW_TEST_COMMAND: pytest {project}/tests/unit + CIBW_TEST_REQUIRES: "pytest scipy sympy" + + - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 + with: + name: macos-x86-64 path: ./wheelhouse/*.whl sdist: @@ -129,11 +178,15 @@ jobs: with: python-version: "3.12" + - name: Install build dependencies + run: | + python3.12 -m pip install build + - name: Generate sdist (source distribution) env: BEZIER_NO_EXTENSION: "True" run: | - python3.12 setup.py sdist + python3.12 -m build --sdist . - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: @@ -167,7 +220,7 @@ jobs: "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" >> $env:GITHUB_PATH - name: Build wheels - uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf #v2.19.1 + uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 env: BEZIER_INSTALL_PREFIX: .\.nox\.cache\libbezier-release\usr CIBW_ARCHS: AMD64 @@ -183,7 +236,7 @@ jobs: --add-path .\.nox\.cache\libbezier-release\usr\bin {wheel} CIBW_TEST_COMMAND: pytest {project}/tests/unit - CIBW_TEST_REQUIRES: pytest + CIBW_TEST_REQUIRES: "pytest scipy sympy" - uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 with: diff --git a/noxfile.py b/noxfile.py index 4fe07d51..b836fbc3 100644 --- a/noxfile.py +++ b/noxfile.py @@ -667,8 +667,17 @@ def _cmake(session, build_type): ] if IS_WINDOWS: build_args.extend(["-G", "MinGW Makefiles"]) - if IS_MACOS: - build_args.append("-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=13.0") + + cmake_osx_deployment_target = os.environ.get("CMAKE_OSX_DEPLOYMENT_TARGET") + if cmake_osx_deployment_target is not None: + build_args.append( + f"-DCMAKE_OSX_DEPLOYMENT_TARGET={cmake_osx_deployment_target}" + ) + + cmake_fortran_compiler = os.environ.get("CMAKE_FORTRAN_COMPILER") + if cmake_fortran_compiler is not None: + build_args.append(f"-DCMAKE_Fortran_COMPILER={cmake_fortran_compiler}") + if os.environ.get("TARGET_NATIVE_ARCH") == "OFF": build_args.append("-DTARGET_NATIVE_ARCH:BOOL=OFF") diff --git a/scripts/macos/build-wheels-arm.sh b/scripts/macos/build-wheels-arm.sh deleted file mode 100755 index 06061cfd..00000000 --- a/scripts/macos/build-wheels-arm.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e -x - -GIT_ROOT=$(git rev-parse --show-toplevel) -cd "${GIT_ROOT}" - -export TARGET_NATIVE_ARCH=OFF -nox --session libbezier-release --reuse-existing-virtualenvs - -export CIBW_BEFORE_BUILD='pip install numpy' -export CIBW_BUILD='cp310-*arm64* cp311-*arm64* cp312-*arm64* ' -export CIBW_TEST_REQUIRES=pytest -export CIBW_TEST_COMMAND='pytest {project}/tests/unit' -BEZIER_INSTALL_PREFIX="$(pwd)/.nox/.cache/libbezier-release/usr" -export BEZIER_INSTALL_PREFIX - -cibuildwheel --platform macos