Building Wheels #41
This file contains 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
# 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. | |
--- | |
name: Building Wheels | |
on: | |
push: | |
tags: | |
- "*" | |
schedule: | |
# Scheduled workflows run on the latest commit on the default or base branch | |
- cron: "0 0 1 * *" | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: Reason for manually triggering workflow | |
required: true | |
jobs: | |
linux: | |
runs-on: ubuntu-22.04 | |
strategy: | |
matrix: | |
include: | |
# NOTE: The ARM build(s) take considerably longer on GitHub Actions. | |
- artifact-name: linux-arm-3.10 | |
cibw-archs: aarch64 | |
cibw-build: cp310-* | |
- artifact-name: linux-arm-3.11 | |
cibw-archs: aarch64 | |
cibw-build: cp311-* | |
- artifact-name: linux-arm-3.12 | |
cibw-archs: aarch64 | |
cibw-build: cp312-* | |
- artifact-name: linux-intel | |
cibw-archs: x86_64 | |
cibw-build: >- | |
cp310-* | |
cp311-* | |
cp312-* | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | |
if: matrix.cibw-archs == 'aarch64' | |
- name: Build wheels | |
uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 | |
env: | |
CIBW_ARCHS: ${{ matrix.cibw-archs }} | |
CIBW_BEFORE_BUILD: | | |
python -m pip install cmake nox numpy | |
nox --session libbezier-release | |
CIBW_BUILD: ${{ matrix.cibw-build }} | |
CIBW_ENVIRONMENT: >- | |
BEZIER_INSTALL_PREFIX=/project/.nox/.cache/libbezier-release/usr | |
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 scipy sympy" | |
CIBW_SKIP: "*musllinux*" | |
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: ./wheelhouse/*.whl | |
macos-arm64: | |
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 `gcc` | |
run: | | |
brew install gcc | |
brew unlink gcc | |
brew link gcc | |
- name: Build `libbezier` | |
env: | |
TARGET_NATIVE_ARCH: "OFF" | |
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: 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 scipy sympy" | |
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
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: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
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 -m build --sdist . | |
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: sdist | |
path: ./dist/*.tar.gz | |
windows-intel: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
with: | |
python-version: "3.12" | |
- name: Build `libbezier` | |
env: | |
TARGET_NATIVE_ARCH: "OFF" | |
run: | | |
py -3.12 -m pip install cmake nox | |
nox --session libbezier-release | |
# MinGW is installed (by default) via Chocolatey: | |
# - https://github.com/actions/runner-images/blob/win22%2F20230724.1/images/win/toolsets/toolset-2022.json#L165 | |
# - https://community.chocolatey.org/packages/mingw/11.2.0.07112021 | |
# - https://github.com/actions/runner-images/issues/6103 | |
- name: Add MinGW bin dir to PATH | |
shell: powershell | |
run: | | |
"C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" >> $env:GITHUB_PATH | |
- name: Build wheels | |
uses: pypa/cibuildwheel@932529cab190fafca8c735a551657247fa8f8eaf # v2.19.1 | |
env: | |
BEZIER_INSTALL_PREFIX: .\.nox\.cache\libbezier-release\usr | |
CIBW_ARCHS: AMD64 | |
CIBW_BEFORE_BUILD: | | |
python -m pip install delvewheel numpy | |
CIBW_BUILD: >- | |
cp310-* | |
cp311-* | |
cp312-* | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >- | |
delvewheel repair | |
--wheel-dir {dest_dir} | |
--add-path .\.nox\.cache\libbezier-release\usr\bin | |
{wheel} | |
CIBW_TEST_COMMAND: pytest {project}/tests/unit | |
CIBW_TEST_REQUIRES: "pytest scipy sympy" | |
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: windows-intel | |
path: .\wheelhouse\*.whl |