[pre-commit.ci] pre-commit autoupdate #580
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
name: Wheels | |
on: | |
push: | |
branches: | |
- master | |
- stable | |
- docs | |
- actions* | |
tags: | |
- v* | |
workflow_dispatch: | |
jobs: | |
sdist: | |
name: Source distribution | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref_name, 'docs') != true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2.0 | |
- name: Install requirements | |
run: | | |
pip install check-manifest twine | |
- name: Run check-manifest | |
run: | | |
python -m check_manifest | |
- name: Build sdist | |
run: | | |
python -m build --sdist --outdir wheelhouse | |
- name: Install from sdist | |
run: | | |
pip install wheelhouse/*.tar.gz | |
- name: Check sdist | |
run: | | |
python -m twine check wheelhouse/* | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: wheelhouse/*.tar.gz | |
wheels: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- runs-on: ubuntu-latest | |
cibw-arch: manylinux_x86_64 | |
- runs-on: ubuntu-latest | |
cibw-arch: manylinux_i686 | |
- runs-on: ubuntu-latest | |
cibw-arch: musllinux_x86_64 | |
- runs-on: ubuntu-latest | |
cibw-arch: musllinux_i686 | |
- runs-on: macos-latest | |
cibw-arch: macosx_x86_64 | |
- runs-on: macos-latest | |
cibw-arch: macosx_arm64 | |
- runs-on: macos-latest | |
cibw-arch: macosx_universal2 | |
- runs-on: windows-latest | |
cibw-arch: win_amd64 | |
- runs-on: windows-latest | |
cibw-arch: win32 | |
python-arch: x86 | |
name: Wheels • ${{ matrix.cibw-arch }} | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: ${{ matrix.python-arch }} | |
- name: Setup CMake | |
uses: jwlawson/actions-setup-cmake@v2.0 | |
- name: Install requirements | |
run: | | |
pip install cibuildwheel twine | |
- name: Configure cibuildwheel | |
shell: bash | |
run: | | |
CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}" | |
CMAKE_OSX_ARCHITECTURES=${{ matrix.cibw-arch == 'macosx_x86_64' && 'x86_64' || matrix.cibw-arch == 'macosx_arm64' && 'arm64' || matrix.cibw-arch == 'macosx_universal2' && '"arm64;x86_64"' || '' }} | |
echo "CIBW_ARCHS_MACOS=x86_64 arm64 universal2" >> $GITHUB_ENV | |
echo "CIBW_BUILD=*-${{ matrix.cibw-arch }}" >> $GITHUB_ENV | |
echo "CIBW_MANYLINUX_X86_64_IMAGE=manylinux2014" >> $GITHUB_ENV | |
echo "CIBW_MANYLINUX_I686_IMAGE=manylinux2014" >> $GITHUB_ENV | |
CIBW_ENVIRONMENT_COMMON="PARSELMOUTH_EXTRA_CMAKE_ARGS=\"-DPREBUILT_DEPENDENCIES=\$(python -c 'import os; print(os.getcwd().replace(os.path.sep, '/'))')/build_dependencies\" CMAKE_BUILD_PARALLEL_LEVEL=2" | |
echo "CIBW_ENVIRONMENT=$CIBW_ENVIRONMENT_COMMON" >> $GITHUB_ENV | |
echo "CIBW_ENVIRONMENT_LINUX=$CIBW_ENVIRONMENT_COMMON PIP_ONLY_BINARY='numpy'" >> $GITHUB_ENV | |
echo "CIBW_ENVIRONMENT_MACOS=$CIBW_ENVIRONMENT_COMMON MACOSX_DEPLOYMENT_TARGET=10.9 CMAKE_OSX_ARCHITECTURES=\"$CMAKE_OSX_ARCHITECTURES\"" >> $GITHUB_ENV | |
CIBW_BEFORE_ALL_COMMON="cmake -S . -B build_dependencies $CMAKE_ARCH && cmake --build build_dependencies --target praat -j 2" | |
echo "CIBW_BEFORE_ALL=$CIBW_BEFORE_ALL_COMMON" >> $GITHUB_ENV | |
echo "CIBW_BEFORE_ALL_WINDOWS=$CIBW_BEFORE_ALL_COMMON --config Release" >> $GITHUB_ENV | |
echo "CIBW_BEFORE_BUILD=rm -rf _skbuild" >> $GITHUB_ENV | |
- name: Only build ReadTheDocs wheel | |
if: startsWith(github.ref_name, 'docs') | |
shell: bash | |
run: | | |
echo "CIBW_BUILD=cp311-manylinux_x86_64" >> $GITHUB_ENV | |
- name: Run cibuildwheel | |
if: startsWith(github.ref_name, 'docs') != true || matrix.cibw-arch == 'manylinux_x86_64' | |
run: | | |
cibuildwheel | |
- name: Check built wheels | |
if: startsWith(github.ref_name, 'docs') != true || matrix.cibw-arch == 'manylinux_x86_64' | |
run: | | |
twine check wheelhouse/* | |
- name: Upload built wheels | |
if: startsWith(github.ref_name, 'docs') != true | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.cibw-arch }} | |
path: wheelhouse/praat_parselmouth-*.whl | |
if-no-files-found: error | |
- name: Upload wheel for ReadTheDocs | |
if: matrix.cibw-arch == 'manylinux_x86_64' && github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions') | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rtd-wheel | |
path: wheelhouse/praat_parselmouth-*-cp311-cp311-*manylinux2014_x86_64*.whl | |
if-no-files-found: error | |
trigger_rtd: | |
name: Trigger ReadTheDocs build | |
runs-on: ubuntu-latest | |
if: github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions') | |
needs: [wheels] | |
steps: | |
- name: Trigger ReadTheDocs webhook | |
run: | | |
curl -X POST -d "branches=${{ github.ref_name }}" -d "token=${{ secrets.READTHEDOCS_WEBHOOK_TOKEN }}" https://readthedocs.org/api/v2/webhook/parselmouth/15985/ | |
create_release: | |
name: Create release | |
runs-on: ubuntu-latest | |
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') | |
needs: [sdist, wheels] | |
steps: | |
- name: Collect sdist and wheels | |
uses: actions/download-artifact@v4 | |
with: | |
path: wheelhouse | |
merge-multiple: true | |
- name: Upload sdist and wheels to release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ github.ref_name }} | |
draft: true | |
artifacts: wheelhouse/* | |
token: ${{ secrets.GITHUB_TOKEN }} |