Skip to content

Don't pip install --user in CI, resolving issue with PyPy 3.10 #583

Don't pip install --user in CI, resolving issue with PyPy 3.10

Don't pip install --user in CI, resolving issue with PyPy 3.10 #583

Workflow file for this run

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@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
pip install --user 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 --user wheelhouse/*.tar.gz
- name: Check sdist
run: |
python -m twine check wheelhouse/*
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/*.tar.gz
wheels:
strategy:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
manylinux: manylinux2010
cibw-skip: pp39-manylinux_* pp310-manylinux_* cp311-* cp312-* cp313-*
- runs-on: ubuntu-latest
cibw-arch: manylinux_i686
manylinux: manylinux2010
cibw-skip: pp39-manylinux_* pp310-manylinux_* cp311-* cp312-* cp313-*
- runs-on: ubuntu-latest
cibw-arch: manylinux_x86_64
manylinux: manylinux2014
cibw-skip: cp36-* cp37-* cp38-* cp39-* cp310-* pp37-* pp38-*
- runs-on: ubuntu-latest
cibw-arch: manylinux_i686
manylinux: manylinux2014
cibw-skip: cp36-* cp37-* cp38-* cp39-* cp310-* pp37-* pp38-*
- 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-2019
cibw-arch: win_amd64
- runs-on: windows-2019
cibw-arch: win32
python-arch: x86
name: Wheels • ${{ matrix.cibw-arch }}
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: ${{ matrix.python-arch }}
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
python -m 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_SKIP=${{ matrix.cibw-skip }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_X86_64_IMAGE=${{ matrix.manylinux }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_I686_IMAGE=${{ matrix.manylinux }}" >> $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=cp39-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@v3
with:
name: wheels
path: wheelhouse/praat_parselmouth-*.whl
if-no-files-found: error
- name: Upload wheel for ReadTheDocs
if: matrix.cibw-arch == 'manylinux_x86_64' && matrix.manylinux == 'manylinux2010' && github.ref_type == 'branch' && !startsWith(github.ref_name, 'actions')
uses: actions/upload-artifact@v3
with:
name: rtd-wheel
path: wheelhouse/praat_parselmouth-*-cp39-cp39-*manylinux2010_x86_64*.whl
if-no-files-found: error
legacy-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: macos-12
cibw-arch: macosx_x86_64
- runs-on: windows-2019
cibw-arch: win_amd64
- runs-on: windows-2019
cibw-arch: win32
python-arch: x86
name: Wheels (legacy) • ${{ matrix.cibw-arch }}
runs-on: ${{ matrix.runs-on }}
if: startsWith(github.ref_name, 'docs') != true
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: ${{ matrix.python-arch }}
- name: Setup CMake
uses: jwlawson/[email protected]
- name: Install requirements
run: |
python -m pip install "cibuildwheel<2" twine
- name: Configure cibuildwheel
shell: bash
run: |
CMAKE_ARCH="${{ matrix.cibw-arch == 'win32' && '-A Win32' || '' }}"
echo "DISTUTILS_USE_SDK=1" >> $GITHUB_ENV
echo "MSSdk=1" >> $GITHUB_ENV
echo "CIBW_BUILD=cp27-${{ matrix.cibw-arch }} cp35-${{ matrix.cibw-arch }} pp27-${{ matrix.cibw-arch }} pp36-${{ matrix.cibw-arch }} ${{ matrix.cibw-arch == 'win32' && 'pp37-win32' || '' }}" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_X86_64_IMAGE=manylinux2010" >> $GITHUB_ENV
echo "CIBW_MANYLINUX_I686_IMAGE=manylinux2010" >> $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" >> $GITHUB_ENV
CIBW_BEFORE_ALL_COMMON="pip install cmake && 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=python -m pip install -U pip && rm -rf _skbuild" >> $GITHUB_ENV
- name: Run cibuildwheel
run: |
python -c "import toml; p = toml.load(open('pyproject.toml')); r = p['build-system']['requires']; r[r.index('wheel')] += '<0.40'; r[r.index('cmake>=3.18')] += ',<3.27.9'; toml.dump(p, open('pyproject.toml', 'w'))"
cibuildwheel
- name: Check built wheels
run: |
twine check wheelhouse/*
- name: Upload built wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: wheelhouse/praat_parselmouth-*.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, legacy-wheels]
steps:
- name: Collect sdist and wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheelhouse
- 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 }}