Building Wheels #45
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@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0 | |
if: matrix.cibw-archs == 'aarch64' | |
- name: Build wheels | |
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: ./wheelhouse/*.whl | |
macos-arm64: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.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@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: macos-arm64 | |
path: ./wheelhouse/*.whl | |
macos-x86-64: | |
runs-on: macos-14 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.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@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: macos-x86-64 | |
path: ./wheelhouse/*.whl | |
sdist: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: sdist | |
path: ./dist/*.tar.gz | |
windows-intel: | |
runs-on: windows-2022 | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.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@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: windows-intel | |
path: .\wheelhouse\*.whl |