Skip to content

Commit

Permalink
Config with c code template (#41)
Browse files Browse the repository at this point in the history
* Drop support for Python 2.7, 3.5, 3.6.
* Add support for Python 3.11.
  • Loading branch information
Michael Howitz committed Jan 17, 2023
1 parent 6980a71 commit d2a2036
Show file tree
Hide file tree
Showing 54 changed files with 625 additions and 463 deletions.
158 changes: 86 additions & 72 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,22 @@ jobs:
fail-fast: false
matrix:
python-version:
- "2.7"
- "3.5"
- "pypy-2.7"
- "pypy-3.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
os: [ubuntu-20.04, macos-latest]
- "3.11"
os: [ubuntu-20.04, macos-11]
exclude:
- os: macos-latest
python-version: "pypy-2.7"
- os: macos-latest
- os: macos-11
python-version: "pypy-3.7"
- os: macos-latest
python-version: "3.5"

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
###
Expand All @@ -130,63 +123,92 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Build Dependencies (PyPy2)
if: >
startsWith(matrix.python-version, 'pypy-2.7')
run: |
pip install -U pip
pip install -U setuptools wheel twine "cffi != 1.15.1"
- name: Install Build Dependencies (other Python versions)
if: >
!startsWith(matrix.python-version, 'pypy-2.7')
- name: Install Build Dependencies
run: |
pip install -U pip
pip install -U setuptools wheel twine cffi
- name: Build zope.index (Python 3.10 on MacOS)
- name: Build zope.index (macOS x86_64, Python 3.8+)
if: >
startsWith(runner.os, 'Mac')
&& startsWith(matrix.python-version, '3.10')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
env:
_PYTHON_HOST_PLATFORM: macosx-11-x86_64
MACOSX_DEPLOYMENT_TARGET: 10.9
_PYTHON_HOST_PLATFORM: macosx-10.9-x86_64
ARCHFLAGS: -arch x86_64
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Build zope.index (macOS arm64, Python 3.8+)
if: >
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
_PYTHON_HOST_PLATFORM: macosx-11.0-arm64
ARCHFLAGS: -arch arm64
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
# Also install it, so that we get dependencies in the (pip) cache.
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
pip install .[test]
- name: Build zope.index (all other versions)
if: >
!startsWith(runner.os, 'Mac')
|| !startsWith(matrix.python-version, '3.10')
|| startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7'
run: |
# Next, build the wheel *in place*. This helps ccache, and also lets us cache the configure
# output (pip install uses a random temporary directory, making this difficult).
python setup.py build_ext -i
python setup.py bdist_wheel
# Also install it, so that we get dependencies in the (pip) cache.
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
- name: Install zope.index and dependencies
run: |
# Install to collect dependencies into the (pip) cache.
pip install .[test]
- name: Check zope.index build
run: |
ls -l dist
twine check dist/*
- name: Upload zope.index wheel
uses: actions/upload-artifact@v2
- name: Upload zope.index wheel (macOS x86_64)
if: >
startsWith(runner.os, 'Mac')
uses: actions/upload-artifact@v3
with:
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/*x86_64.whl
- name: Upload zope.index wheel (macOS arm64)
if: >
startsWith(runner.os, 'Mac')
&& !(startsWith(matrix.python-version, 'pypy')
|| matrix.python-version == '3.7')
uses: actions/upload-artifact@v3
with:
# The arm64 wheel is uploaded with a different name just so it can be
# manually downloaded when desired. The wheel itself *cannot* be tested
# on the GHA runner, which uses x86_64 architecture.
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}-arm64.whl
path: dist/*arm64.whl
- name: Upload zope.index wheel (all other platforms)
if: >
!startsWith(runner.os, 'Mac')
uses: actions/upload-artifact@v3
with:
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/*whl
Expand All @@ -211,29 +233,22 @@ jobs:
fail-fast: false
matrix:
python-version:
- "2.7"
- "3.5"
- "pypy-2.7"
- "pypy-3.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
os: [ubuntu-20.04, macos-latest]
- "3.11"
os: [ubuntu-20.04, macos-11]
exclude:
- os: macos-latest
python-version: "pypy-2.7"
- os: macos-latest
- os: macos-11
python-version: "pypy-3.7"
- os: macos-latest
python-version: "3.5"

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
###
Expand All @@ -245,26 +260,26 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download zope.index wheel
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install zope.index
run: |
pip install -U wheel setuptools
pip install -U coverage
pip install -U 'faulthandler; python_version == "2.7" and platform_python_implementation == "CPython"'
pip install -U 'cffi; platform_python_implementation == "CPython"'
# Unzip into src/ so that testrunner can find the .so files
# when we ask it to load tests from that directory. This
# might also save some build time?
Expand Down Expand Up @@ -308,9 +323,9 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
###
Expand All @@ -322,18 +337,18 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download zope.index wheel
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
Expand All @@ -359,9 +374,9 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
###
Expand All @@ -373,18 +388,18 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: Download zope.index wheel
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: zope.index-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
Expand All @@ -403,17 +418,18 @@ jobs:
manylinux:
runs-on: ubuntu-20.04
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
# We use a regular Python matrix entry to share as much code as possible.
strategy:
matrix:
python-version: ["3.9"]
image: [manylinux2010_x86_64, manylinux2010_i686, manylinux2014_aarch64]
image: [manylinux2014_x86_64, manylinux2014_i686, manylinux2014_aarch64]

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
###
Expand All @@ -425,10 +441,10 @@ jobs:
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}
Expand All @@ -438,18 +454,16 @@ jobs:
- name: Update pip
run: pip install -U pip
- name: Build zope.index (x86_64)
if: matrix.image == 'manylinux2010_x86_64'
if: matrix.image == 'manylinux2014_x86_64'
# An alternate way to do this is to run the container directly with a uses:
# and then the script runs inside it. That may work better with caching.
# See https://github.com/pyca/bcrypt/blob/f6b5ee2eda76d077c531362ac65e16f045cf1f29/.github/workflows/wheel-builder.yml
# The 2010 image is the most recent spec that comes with Python 2.7,
# and only up through the tag 2021-02-06-3d322a5
env:
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}
run: |
bash .manylinux.sh
- name: Build zope.index (i686)
if: matrix.image == 'manylinux2010_i686'
if: matrix.image == 'manylinux2014_i686'
env:
DOCKER_IMAGE: quay.io/pypa/${{ matrix.image }}
PRE_CMD: linux32
Expand All @@ -465,14 +479,14 @@ jobs:
bash .manylinux.sh
- name: Upload zope.index wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*whl
name: manylinux_${{ matrix.image }}_wheels.zip
- name: Restore pip cache permissions
run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }}
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.1
uses: pypa/gh-action-pypi-publish@release/v1
if: >
github.event_name == 'push'
&& startsWith(github.ref, 'refs/tags')
Expand Down
8 changes: 2 additions & 6 deletions .manylinux-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,19 @@ yum -y install libffi-devel

tox_env_map() {
case $1 in
*"cp27"*) echo 'py27';;
*"cp35"*) echo 'py35';;
*"cp36"*) echo 'py36';;
*"cp37"*) echo 'py37';;
*"cp38"*) echo 'py38';;
*"cp39"*) echo 'py39';;
*"cp310"*) echo 'py310';;
*"cp311"*) echo 'py311';;
*) echo 'py';;
esac
}

# Compile wheels
for PYBIN in /opt/python/*/bin; do
if \
[[ "${PYBIN}" == *"cp27"* ]] || \
[[ "${PYBIN}" == *"cp35"* ]] || \
[[ "${PYBIN}" == *"cp36"* ]] || \
[[ "${PYBIN}" == *"cp311"* ]] || \
[[ "${PYBIN}" == *"cp37"* ]] || \
[[ "${PYBIN}" == *"cp38"* ]] || \
[[ "${PYBIN}" == *"cp39"* ]] || \
Expand Down

0 comments on commit d2a2036

Please sign in to comment.