Skip to content

Build Wheels

Build Wheels #364

Workflow file for this run

name: Build Wheels
on:
workflow_dispatch:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
# branches: [ "main" ]
# paths-ignore:
# - "examples/**"
# - "doc/**"
# - "README.md"
# - "*.txt"
# - "CHANGELOG"
# pull_request:
# branches: [ "main" ]
# types:
# - opened
# - reopened
# - synchronize
# paths-ignore:
# - "examples/**"
# - "doc/**"
# - "README.md"
# - "*.txt"
# - "CHANGELOG"
#
env:
BUILD_TYPE: Release
VERBOSE: 1
# VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite;nuget,GitHub,readwrite'
VCPKG_BINARY_SOURCES: 'clear;x-gha,readwrite'
jobs:
build_sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Build sdist
run: |
python -m pip install build
python -m build --sdist .
env:
SETUPTOOLS_SCM_DEBUG: 1
- name: Check sdist
run: |
python -m pip install twine
twine check dist/*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: ./dist/*
build_wheels:
name: Build wheel for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-2022
- macos-13 # Uses x64
- macos-14 # Uses Apple Silicon
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Setup gha caching for vcpkg
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Setup msbuild on Windows
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Enable developer command prompt
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Install build deps on MacOs
if: runner.os == 'macOs'
run: brew install autoconf automake libtool m4 ninja
- name: Build and test
uses: pypa/[email protected]
env:
MACOSX_DEPLOYMENT_TARGET: 11.0.0
GITHUB_TOK: "${{ secrets.GITHUB_TOKEN }}"
CMAKE_GENERATOR: "Ninja"
- uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
publish:
runs-on: ubuntu-latest
needs: [ build_wheels, build_sdist ]
if: ${{ github.event_name == 'push' }}
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install release deps
run: python -m pip install twine
- name: Retrieve sdist
uses: actions/download-artifact@v4
with:
name: sdist
path: dist
- name: Retrieve wheels
uses: actions/download-artifact@v4
with:
pattern: "cibw-*"
path: dist
merge-multiple: true
- name: Update release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release -R "${{ github.repository }}" upload "${{ github.ref_name }}" dist/*
- name: Publish
run: |
python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}