Skip to content

Commit

Permalink
Create wheels with CIBW (#1)
Browse files Browse the repository at this point in the history
* Switch to using cbiw.

* Switch to build for sdist.

* Don't run on PR and exclude muslinux.
  • Loading branch information
matham authored Mar 19, 2022
1 parent ef796de commit 35eddba
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 145 deletions.
18 changes: 0 additions & 18 deletions .ci/manylinux_wheels.sh

This file was deleted.

180 changes: 58 additions & 122 deletions .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
@@ -1,178 +1,114 @@
name: Garden flower
on: [push, pull_request]
on: [push]

env:
DOCKER_IMAGE: 'quay.io/pypa/manylinux2010_x86_64'

jobs:
lint_test:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip virtualenv wheel setuptools
- name: Lint with pycodestyle
run: |
python3 -m pip install flake8
python3 -m flake8 . --count --ignore=E125,E126,E127,E128,E402,E741,E731,W503,F401,W504,F841 --show-source --statistics --max-line-length=80 --exclude=__pycache__,.tox,.git/,doc/
linux_test:
runs-on: ubuntu-18.04
build_wheels:
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
env:
DISPLAY: :99.0
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
with:
python-version: 3.x
- name: Install dependencies
run: |
sudo apt update
sudo apt -y install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev
sudo apt-get -y install python3-setuptools build-essential libgl1-mesa-dev libgles2-mesa-dev
/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1280x720x24 -ac +extension GLX
CIBW_BUILD: cp3{7,8,9,10}-*
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BUILD_VERBOSITY: 3
CIBW_TEST_SKIP: "*macosx*arm64*"
CIBW_SKIP: "*musllinux*"

python3 -m pip install --upgrade pip virtualenv wheel setuptools
python3 -m pip install kivy[base] --pre --extra-index-url https://kivy.org/downloads/simple/
- name: Install flower
run: python3 -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Test with pytest
run: |
flower_name=$(python3 -c "print('$GITHUB_REPOSITORY'.split('/')[-1])")
python3 -m pytest --cov=kivy_garden.$flower_name --cov-report term --cov-branch
strategy:
matrix:
include:
- arch: "arm64 x86_64 universal2"
os: macos-latest
- arch: aarch64
os: ubuntu-latest
- arch: x86_64
os: ubuntu-latest
- arch: "x86 AMD64"
os: windows-latest

manylinux2010:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.x
uses: actions/setup-python@v1
- uses: actions/checkout@v2

- uses: actions/setup-python@v2
name: Install Python
with:
python-version: 3.x
python-version: '3.x'

- name: Make sdist
run: python3 setup.py sdist --formats=gztar
- name: Make wheels
if: ${{ matrix.os == 'windows-latest' }}
run: |
chmod +x .ci/manylinux_wheels.sh
docker run --rm -v "$(pwd):/io" "$DOCKER_IMAGE" "/io/.ci/manylinux_wheels.sh"
ls dist
rm dist/*-linux*
ls dist
python -m pip install build
python -m build --sdist
- uses: docker/setup-qemu-action@v1
if: ${{ matrix.arch == 'aarch64' }}
name: Set up QEMU

- name: Install cibuildwheel
run: python -m pip install cibuildwheel

- name: Build wheels
run: python -m cibuildwheel --output-dir dist

- name: Upload wheels as artifact
uses: actions/upload-artifact@master
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
uses: softprops/action-gh-release@v0.1.14
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
draft: true

windows_wheels_test:
windows_test:
runs-on: windows-latest
strategy:
matrix:
python: [ '3.6', '3.7', '3.8' ]
arch: ['x64', 'x86']
env:
KIVY_GL_BACKEND: angle_sdl2

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.arch }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip virtualenv wheel setuptools
python -m pip install kivy[win_full] --pre --extra-index-url https://kivy.org/downloads/simple/
python-version: 3.x

- name: Install flower
run: python -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Make wheel
run: python setup.py bdist_wheel
- name: Upload wheels as artifact
uses: actions/upload-artifact@master
with:
name: wheels
path: dist
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
draft: true
run: python -m pip install -e .[dev,ci]

- name: Test with pytest
run: |
$flower_name=(python -c "print('$GITHUB_REPOSITORY'.split('/')[-1])")
python -m pytest --cov=kivy_garden.$flower_name --cov-report term --cov-branch
osx_wheels:
runs-on: macOS-latest
strategy:
matrix:
python: [ '3.5', '3.6', '3.7', '3.8' ]
steps:
- uses: actions/checkout@v1
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip virtualenv wheel setuptools
python3 -m pip install kivy[full] --pre --extra-index-url https://kivy.org/downloads/simple/
python3 -m pip install --upgrade delocate
- name: Install flower
run: python3 -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
- name: Make wheel
run: python3 setup.py bdist_wheel
- name: Delocate wheel
run: |
delocate-wheel dist/*.whl
delocate-addplat --rm-orig -x 10_9 -x 10_10 dist/*.whl
- name: Upload wheels as artifact
uses: actions/upload-artifact@master
with:
name: wheels
path: dist
- name: Upload to GitHub Release
uses: softprops/action-gh-release@78c309ef59fdb9557cd6574f2e0be552936ed728
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
draft: true

docs:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python 3.x
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install dependencies
env:
KIVY_DOC_INCLUDE: 1
KIVY_DOC: 1
run: |
python3 -m pip install --upgrade pip virtualenv wheel setuptools sphinx
python3 -m pip install kivy[base] --pre --extra-index-url https://kivy.org/downloads/simple/
python3 -m pip install -e .[dev,ci] --extra-index-url https://kivy-garden.github.io/simple/
run: python3 -m pip install -e .[dev,ci]
- name: Generate docs
run: |
cd doc
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[build-system]
requires = [
"setuptools", "wheel", "cython",
]
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ def build_extensions(self):
for e in ext_modules:
e.cython_directives = {"embedsignature": True, 'language_level': 3}

setup_requires = []
if declare_cython:
setup_requires.append('cython')

setup(
name='kivy_garden.collider',
Expand All @@ -144,8 +141,7 @@ def build_extensions(self):
keywords='Kivy kivy-garden',

packages=find_namespace_packages(include=['kivy_garden.*']),
setup_requires=setup_requires,
install_requires=[],
install_requires=['kivy'],
extras_require={
'dev': ['pytest>=3.6', 'wheel', 'pytest-cov', 'pytest-asyncio',
'sphinx_rtd_theme'],
Expand Down

0 comments on commit 35eddba

Please sign in to comment.