Skip to content

Commit

Permalink
Build extra wheels (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov authored Oct 15, 2021
1 parent ea44d6e commit 5248837
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 95 deletions.
135 changes: 51 additions & 84 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,115 +184,82 @@ jobs:
name: dist
path: dist

build-linux:
name: Linux
build-wheels:
name: Build wheels on ${{ matrix.os }} ${{ matrix.qemu }}
runs-on: ${{ matrix.os }}-latest
needs: pre-deploy
strategy:
matrix:
pyver: [cp36-cp36m, cp37-cp37m, cp38-cp38, cp39-cp39, cp310-cp310]
arch: [x86_64, aarch64, i686, ppc64le, s390x]
fail-fast: false
runs-on: ubuntu-latest
env:
py: /opt/python/${{ matrix.pyver }}/bin/python
img: quay.io/pypa/manylinux2014_${{ matrix.arch }}
needs: pre-deploy
os: [ubuntu, windows, macos]
qemu: ['']
include:
# Split ubuntu job for the sake of speed-up
- os: ubuntu
qemu: aarch64
- os: ubuntu
qemu: ppc64le
- os: ubuntu
qemu: s390x
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4
- name: Set up QEMU
id: qemu
if: ${{ matrix.qemu }}
uses: docker/setup-qemu-action@v1
- name: Available platforms
run: echo ${{ steps.qemu.outputs.platforms }}
- name: Setup Python
uses: actions/setup-python@v2
- name: Install cython
if: matrix.no-extensions == ''
uses: py-actions/py-dependency-install@v2
with:
path: requirements/cython.txt
- name: Cythonize
if: matrix.no-extensions == ''
run: |
make cythonize
- name: Install tools
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
${{ env.img }} ${{ env.py }} -m pip install -U setuptools wheel
- name: Make wheel
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
${{ env.img }} ${{ env.py }} setup.py bdist_wheel
- name: Repair wheel wheel
platforms: all
id: qemu
- name: Prepare emulation
run: |
docker run --rm -v ${{ github.workspace }}:/ws:rw --workdir=/ws \
${{ env.img }} auditwheel repair dist/*.whl --wheel-dir wheelhouse/
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: dist
path: wheelhouse/*

build-binary:
name: Binary wheels
strategy:
matrix:
pyver: [3.6, 3.7, 3.8, 3.9, 3.10]
os: [macos, windows]
arch: [x86, x64]
exclude:
- os: macos
arch: x86
fail-fast: false
runs-on: ${{ matrix.os }}-latest
needs: pre-deploy
steps:
- name: Checkout
uses: actions/checkout@v2
if [[ -n "${{ matrix.qemu }}" ]]; then
# Build emulated architectures only if QEMU is set,
# use default "auto" otherwise
echo "CIBW_ARCHS_LINUX=${{ matrix.qemu }}" >> $GITHUB_ENV
fi
shell: bash
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.pyver }}
architecture: ${{ matrix.arch }}
uses: actions/setup-python@v2.2.2
- name: Install cython
if: matrix.no-extensions == ''
uses: py-actions/py-dependency-install@v2
with:
path: requirements/cython.txt
- name: Cythonize
if: matrix.no-extensions == ''
run: |
make cythonize
- name: Install dependencies
run: |
python -m pip install -U setuptools wheel
- name: Make wheel
run:
python setup.py bdist_wheel
- name: Upload artifacts
uses: actions/upload-artifact@v2
- name: Build wheels
uses: pypa/cibuildwheel@v2.2.0a1
env:
CIBW_ARCHS_MACOS: x86_64 arm64 universal2
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
path: ./wheelhouse/*.whl

deploy:
name: Deploy
needs: [build-linux, build-binary, build-tarball]
environment: release
needs: [build-tarball, build-wheels]
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v2
- name: Install twine
run: |
python -m pip install twine
- name: Download dists
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Download dist
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: PyPI upload
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- run: |
tree
- name: Login
run: |
twine upload dist/*
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Make Release
uses: aio-libs/create-release@v1.2.1
with:
changes_file: CHANGES.rst
name: frozenlist
version_file: frozenlist/__init__.py
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
fix_issue_regex: "`#(\\d+) <https://github.com/aio-libs/frozenlist/issues/\\1>`"
fix_issue_repl: "(#\\1)"
19 changes: 19 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,25 @@ Changelog

.. towncrier release notes start
1.2.0a8 (2021-10-15)
====================

Features
--------

- ``FrozenList`` now supports being used as a generic type as per PEP 585, e.g. ``frozen_int_list: FrozenList[int]`` (requires Python 3.9 or newer).
`#172 <https://github.com/aio-libs/frozenlist/issues/172>`_
- Added support for Python 3.10.
`#227 <https://github.com/aio-libs/frozenlist/issues/227>`_
- Started shipping platform-specific wheels with the ``musl`` tag targeting typical Alpine Linux runtimes.
`#227 <https://github.com/aio-libs/frozenlist/issues/227>`_
- Started shipping platform-specific arm64 wheels for Apple Silicon.
`#227 <https://github.com/aio-libs/frozenlist/issues/227>`_


----


1.1.1 (2020-11-14)
==================

Expand Down
1 change: 0 additions & 1 deletion CHANGES/172.feature

This file was deleted.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
'..', 'frozenlist', '__init__.py'))
with io.open(_version_path, 'r', encoding='latin1') as fp:
try:
_version_info = re.search(r"^__version__ = '"
_version_info = re.search(r'^__version__ = "'
r"(?P<major>\d+)"
r"\.(?P<minor>\d+)"
r"\.(?P<patch>\d+)"
r"(?P<tag>.*)?'$",
r'(?P<tag>.*)?"$',
fp.read(), re.M).groupdict()
except IndexError:
raise RuntimeError('Unable to determine version.')
Expand Down
12 changes: 6 additions & 6 deletions frozenlist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
from functools import total_ordering
from typing import Tuple, Type

__version__ = '1.1.1'
__version__ = "1.2.0a8"

__all__ = (
'FrozenList', 'PyFrozenList'
"FrozenList", "PyFrozenList"
) # type: Tuple[str, ...]


NO_EXTENSIONS = bool(os.environ.get('FROZENLIST_NO_EXTENSIONS')) # type: bool
NO_EXTENSIONS = bool(os.environ.get("FROZENLIST_NO_EXTENSIONS")) # type: bool


@total_ordering
class FrozenList(MutableSequence):

__slots__ = ('_frozen', '_items')
__slots__ = ("_frozen", "_items")

if sys.version_info >= (3, 9):
__class_getitem__ = classmethod(types.GenericAlias)
else:
@classmethod
def __class_getitem__(cls: Type['FrozenList']) -> Type['FrozenList']:
def __class_getitem__(cls: Type["FrozenList"]) -> Type["FrozenList"]:
return cls

def __init__(self, items=None):
Expand Down Expand Up @@ -76,7 +76,7 @@ def insert(self, pos, item):
self._items.insert(pos, item)

def __repr__(self):
return '<FrozenList(frozen={}, {!r})>'.format(self._frozen,
return "<FrozenList(frozen={}, {!r})>".format(self._frozen,
self._items)

def __hash__(self):
Expand Down
9 changes: 8 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires= ['setuptools', 'wheel', 'Cython']
requires= ['setuptools', 'wheel']

[tool.towncrier]
package = "frozenlist"
Expand All @@ -8,3 +8,10 @@ directory = "CHANGES/"
title_format = "{version} ({project_date})"
template = "CHANGES/.TEMPLATE.rst"
issue_format = "`#{issue} <https://github.com/aio-libs/frozenlist/issues/{issue}>`_"

[tool.cibuildwheel]
# test-requires = "-r requirements/ci-wheel.txt"
# test-command = "pytest {project}/tests"

# don't build PyPy wheels, install from source instead
skip = "pp*"
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

txt = (here / 'frozenlist' / '__init__.py').read_text('utf-8')
try:
version = re.findall(r"^__version__ = '([^']+)'\r?$",
version = re.findall(r'^__version__ = "([^"]+)"\r?$',
txt, re.M)[0]
except IndexError:
raise RuntimeError('Unable to determine version.')
Expand Down

0 comments on commit 5248837

Please sign in to comment.