Skip to content

Manylinux wheels

Manylinux wheels #5397

name: Manylinux wheels
on:
push:
pull_request:
create:
schedule:
- cron: '23 1 * * *'
env:
KIVY_SPLIT_EXAMPLES: 1
SERVER_IP: '159.203.106.198'
jobs:
kivy_examples_create:
# we need examples wheel for tests, but only windows actually uploads kivy-examples to pypi/server
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install CI/CD Python requirements
run: |
python -m pip install -r .ci/cicd-requirements.txt
- name: Create wheel
run: |
KIVY_BUILD_EXAMPLES=1 python3 -m build --wheel .
- name: Upload kivy-examples wheel as artifact
uses: actions/upload-artifact@v4
with:
name: linux_examples_wheel
path: dist
manylinux_wheel_create:
env:
CIBW_ENVIRONMENT_LINUX: "KIVY_SPLIT_EXAMPLES=1 USE_X11=1 USE_SDL2=1 USE_PANGOFT2=0 USE_GSTREAMER=0 KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies LD_LIBRARY_PATH=$(pwd)/kivy-dependencies/dist/lib:$(pwd)/kivy-dependencies/dist/lib64"
CIBW_BUILD_VERBOSITY_LINUX: 3
CIBW_BUILD: ${{ matrix.cibw_build }}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BEFORE_ALL_LINUX: >
source .ci/ubuntu_ci.sh &&
install_manylinux_build_deps
runs-on: ubuntu-latest
strategy:
matrix:
include:
- os: ubuntu-latest
cibw_archs: x86_64
cibw_build: 'cp37-manylinux_x86_64 cp38-manylinux_x86_64 cp39-manylinux_x86_64 cp310-manylinux_x86_64 cp311-manylinux_x86_64 cp312-manylinux_x86_64'
- os: ubuntu-latest
cibw_archs: aarch64
cibw_build: 'cp37-manylinux_aarch64 cp38-manylinux_aarch64 cp39-manylinux_aarch64 cp310-manylinux_aarch64 cp311-manylinux_aarch64 cp312-manylinux_aarch64'
if: github.event_name == 'schedule' || (github.event_name == 'create' && github.event.ref_type == 'tag') || contains(github.event.head_commit.message, '[build wheel]') || contains(github.event.head_commit.message, '[build wheel linux]') || contains(github.event.pull_request.title, '[build wheel]') || contains(github.event.pull_request.title, '[build wheel linux]')
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install CI/CD Python requirements
run: |
python -m pip install -r .ci/cicd-requirements.txt
- name: Set up QEMU
if: ${{ matrix.cibw_archs == 'aarch64' }}
uses: docker/setup-qemu-action@v3
- uses: actions/cache@v4
id: deps-cache
with:
path: kivy-dependencies
key: ${{ runner.os }}-${{ matrix.cibw_archs }}-deps-cache-${{ hashFiles('./tools/build_linux_dependencies.sh') }}
- name: Build dependencies
if: ${{ steps.deps-cache.outputs.cache-hit != 'true' }}
run: |
docker run --rm -v `pwd`:/root:rw --workdir=/root \
quay.io/pypa/manylinux2014_${{ matrix.cibw_archs }} \
bash -ec 'source .ci/ubuntu_ci.sh && install_manylinux_build_deps && ./tools/build_linux_dependencies.sh'
- name: Generate version metadata
run: |
source .ci/ubuntu_ci.sh
update_version_metadata
- name: Install CI/CD Python requirements
run: |
python -m pip install -r .ci/cicd-requirements.txt
- name: Make wheels
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload wheels as artifact
uses: actions/upload-artifact@v4
with:
name: manylinux_wheels-${{ matrix.cibw_archs }}
path: ./wheelhouse/*.whl
manylinux_wheel_upload:
runs-on: ubuntu-latest
needs: [manylinux_wheel_create, kivy_examples_create]
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install CI/CD Python requirements
run: |
python -m pip install -r .ci/cicd-requirements.txt
- uses: actions/download-artifact@v4
with:
pattern: manylinux_wheels-*
merge-multiple: true
path: dist
- name: Rename wheels
if: github.event.ref_type != 'tag'
run: |
source .ci/ubuntu_ci.sh
rename_wheels
- name: Upload wheels to server
env:
UBUNTU_UPLOAD_KEY: ${{ secrets.UBUNTU_UPLOAD_KEY }}
run: |
source .ci/ubuntu_ci.sh
upload_file_to_server "$SERVER_IP" "linux/kivy/"
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2.0.5
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/*
draft: true
- name: Publish to PyPI
if: github.event_name == 'create' && github.event.ref_type == 'tag'
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
twine upload dist/*
manylinux_wheel_test:
runs-on: ubuntu-latest
needs: [manylinux_wheel_create, kivy_examples_create]
strategy:
matrix:
python: ['3.8', '3.9', '3.10', '3.11', '3.12' ]
env:
DISPLAY: ':99.0'
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- uses: actions/download-artifact@v4
with:
pattern: manylinux_wheels-*
merge-multiple: true
path: dist
- name: Setup env
run: |
source .ci/ubuntu_ci.sh
prepare_env_for_unittest
- name: Install Kivy
run: |
source .ci/ubuntu_ci.sh
install_kivy_wheel dev
- uses: actions/download-artifact@v4
with:
name: linux_examples_wheel
path: dist
- name: Install kivy-examples wheel
run: |
source .ci/ubuntu_ci.sh
install_kivy_examples_wheel dev
- name: Test Kivy
run: |
source .ci/ubuntu_ci.sh
test_kivy_install
- name: Test Kivy benchmarks
run: |
source .ci/ubuntu_ci.sh
test_kivy_benchmark
- name: Upload benchmarks as artifact
uses: actions/upload-artifact@v4
with:
name: benchmarks-manylinux-wheels-python-${{ matrix.python }}
path: .benchmarks-kivy
sdist_test:
runs-on: ubuntu-latest
env:
DISPLAY: ':99.0'
KIVY_SPLIT_EXAMPLES: 0
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install CI/CD Python requirements
run: |
python -m pip install -r .ci/cicd-requirements.txt
- name: Generate sdist
run: |
python -m build --sdist .
- name: Install dependencies
run: |
source .ci/ubuntu_ci.sh
install_ubuntu_build_deps
./tools/build_linux_dependencies.sh
- name: Setup env
run: |
source .ci/ubuntu_ci.sh
prepare_env_for_unittest
- name: Install Kivy
run: |
source .ci/ubuntu_ci.sh
export KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies
install_kivy_sdist
- name: Test Kivy
run: |
source .ci/ubuntu_ci.sh
test_kivy_install