skip musllinux #143
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: Python Wheel Build | |
on: | |
push: | |
# Trigger the workflow on push, but only for the develop-pypi and master branch | |
branches: [develop-pypi, master] | |
# globals | |
env: | |
PACKAGE_NAME: verovio | |
CHECK_INSTALL_DIR: check_install_dir | |
CIBW_BUILD_IDENTIFIER: "" | |
jobs: | |
#===============================================# | |
# BUILD WHEEL DISTRIBUTION # | |
#===============================================# | |
build_wheels: | |
name: Build wheels (${{ matrix.python-version }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Ensure that a wheel builder finishes even if another fails | |
fail-fast: false | |
# Build the wheels for Linux, Windows and macOS | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
include: | |
- os: macos-latest | |
architecture: x64 | |
platform_id: macosx_* | |
- os: windows-latest | |
architecture: x64 | |
platform_id: win_amd64 | |
- os: windows-latest | |
architecture: x86 | |
platform_id: win32 | |
- os: ubuntu-latest | |
architecture: x64 | |
platform_id: manylinux_x86_64 | |
- os: ubuntu-latest | |
architecture: x64 | |
platform_id: manylinux_aarch64 | |
- os: ubuntu-latest | |
architecture: aarch64 | |
platform_id: manylinux_aarch64 | |
steps: | |
#===============================================# | |
# Set up | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: "latest" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: all | |
#===============================================# | |
# Dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install importlib_resources twine | |
#===============================================# | |
# Prepare identifier | |
- name: Set CIBW_BUILD_IDENTIFIER | |
shell: bash | |
run: | | |
# Remove dot from python-version for CIBW and prefix with cp | |
id=cp$(echo ${{ matrix.python-version }} | sed -e 's/\.//g')* | |
echo CIBW_BUILD_IDENTIFIER=$id >> $GITHUB_ENV | |
echo $id | |
#===============================================# | |
# wheels | |
- name: Build wheels | |
uses: pypa/[email protected] | |
with: | |
output-dir: wheelhouse | |
env: | |
CIBW_SKIP: cp38-win_arm64, *_musllinux* | |
CIBW_BUILD: ${{ env.CIBW_BUILD_IDENTIFIER }} | |
CIBW_ARCHS_LINUX: "auto aarch64" | |
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" | |
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64 *_manylinux_aarch64" | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_I686_IMAGE: manylinux2014 | |
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 | |
CIBW_BEFORE_ALL_MACOS: brew update && brew install swig | |
CIBW_BEFORE_ALL_WINDOWS: choco install swig -f -y | |
CIBW_BEFORE_BUILD: swig -version && bash -c 'cd tools; ./get_git_commit.sh' && swig -c++ -python -py3 ./bindings/python/verovio.i | |
CMAKE_BUILD_PARALLEL_LEVEL: 12 | |
#===============================================# | |
# Check build | |
# TODO: Can be removed when everything is set up | |
- name: "List result" | |
working-directory: wheelhouse | |
run: ls -R | |
- name: Check with Twine | |
working-directory: wheelhouse | |
run: twine check *.whl | |
- name: Install from wheel on Linux | |
if: always() && runner.os == 'Linux' | |
working-directory: wheelhouse | |
run: python -m pip install ./*.whl | |
# Install only the x86_64 wheel on macOS | |
- name: Install from wheel on macOS | |
working-directory: wheelhouse | |
if: always() && runner.os == 'macOS' | |
run: python -m pip install ./*x86_64.whl | |
# Wildcard use is different with PowerShell | |
# cf. https://stackoverflow.com/a/43900040 | |
- name: Install from wheel on Windows | |
working-directory: wheelhouse | |
if: always() && runner.os == 'Windows' | |
run: python -m pip install (get-item .\*.whl).FullName | |
- name: Check wheel installation | |
working-directory: wheelhouse | |
run: python -c "import verovio; tk = verovio.toolkit(); v = tk.getVersion(); print('verovio.toolkit.getVersion():', v)" | |
#===============================================# | |
# Upload artifacts | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: cibuildwheel-${{ runner.os }}-python-${{ matrix.python-version }} | |
path: ./wheelhouse/*.whl | |
#===============================================# | |
# BUILD SOURCE DISTRIBUTION # | |
#===============================================# | |
build_sdist: | |
name: Build sdist | |
runs-on: [ubuntu-latest] | |
steps: | |
#===============================================# | |
# Set up | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
#===============================================# | |
# Swig | |
- name: Install swig | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt update -q | |
sudo apt install swig | |
- name: Verify swig | |
run: swig -version | |
#===============================================# | |
# Dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install setuptools wheel twine | |
#===============================================# | |
# sdist | |
- name: Build ext | |
run: python setup.py build_ext | |
- name: Build source distribution | |
run: python setup.py sdist | |
#===============================================# | |
# Check build | |
# TODO: Can be removed when everything is set up | |
- name: List result | |
working-directory: dist | |
run: ls -R | |
- name: Check with Twine | |
working-directory: dist | |
run: twine check *.tar.gz | |
- name: Create install dir | |
shell: bash | |
run: mkdir - p ${{ env.CHECK_INSTALL_DIR }} | |
- name: Install from source | |
working-directory: ${{ env.CHECK_INSTALL_DIR }} | |
run: python -m pip install ../dist/*.tar.gz | |
- name: Check source installation | |
working-directory: ${{ env.CHECK_INSTALL_DIR }} | |
run: python -c "import verovio; tk = verovio.toolkit(); v = tk.getVersion(); print('verovio.toolkit.getVersion():', v)" | |
#===============================================# | |
# Upload artifact | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sdist-${{ runner.os }}-python-3.9 | |
path: dist/*.tar.gz | |
#===============================================# | |
# UPLOAD TO PACKAGE INDEX # | |
#===============================================# | |
upload_testpypi: | |
name: Upload to TestPyPi | |
needs: [build_wheels, build_sdist] | |
runs-on: [ubuntu-latest] | |
steps: | |
#===============================================# | |
# Set up | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
architecture: "x64" | |
#===============================================# | |
# Dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install twine | |
#===============================================# | |
# Prepare artifacts | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: bindings/python/artifacts/ | |
# TODO: Can be removed when everything is set up | |
- name: Display structure of downloaded files | |
working-directory: bindings/python/artifacts/ | |
run: ls -R | |
- name: Copy artifacts to dist folder | |
working-directory: bindings/python/ | |
run: | | |
mkdir -p ./dist | |
cp artifacts/*/* dist/ | |
# TODO: Can be removed when everything is set up | |
- name: Verify dist folder | |
working-directory: bindings/python/dist/ | |
run: ls -R | |
#===============================================# | |
# Upload to package test index | |
- name: Upload to TestPyPi | |
working-directory: bindings/python | |
env: | |
TWINE_USERNAME: ${{ secrets.TESTPYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.TESTPYPI_TOKEN }} | |
run: twine upload --repository testpypi dist/* | |
#===============================================# | |
# Check test build | |
- name: Create install dir | |
shell: bash | |
run: | | |
mkdir - p ${{ env.CHECK_INSTALL_DIR }} | |
cd ${{ env.CHECK_INSTALL_DIR }} | |
python -m pip install --index-url https://test.pypi.org/simple/ --pre ${{ env.PACKAGE_NAME }} | |
python -c "import verovio; tk = verovio.toolkit(); v = tk.getVersion(); print('verovio.toolkit.getVersion():', v)" |