Skip to content

Commit

Permalink
Build windows wheels on GHA. (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
icemac authored Apr 17, 2024
1 parent ad17d5d commit 2820fea
Show file tree
Hide file tree
Showing 5 changed files with 127 additions and 101 deletions.
169 changes: 123 additions & 46 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ jobs:
- "3.11"
- "3.12"
- "3.13.0-alpha - 3.13.0"
os: [ubuntu-20.04, macos-11]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-11
- os: macos-latest
python-version: "pypy-3.10"

steps:
Expand All @@ -122,15 +122,32 @@ jobs:
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
- name: Get pip cache dir (default)
id: pip-cache-default
if: ${{ !startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
- name: Get pip cache dir (Windows)
id: pip-cache-windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
- name: pip cache (default)
uses: actions/cache@v4
if: ${{ !startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache.outputs.dir }}
path: ${{ steps.pip-cache-default.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: pip cache (Windows)
uses: actions/cache@v4
if: ${{ startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-windows.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
Expand All @@ -140,15 +157,11 @@ jobs:
run: |
pip install -U pip
pip install -U setuptools wheel twine
# cffi will probably have no public release until a Python 3.13 beta
# or even RC release, see https://github.com/python-cffi/cffi/issues/23
echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt
PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install cffi
- name: Install Build Dependencies
if: matrix.python-version != '3.13.0-alpha - 3.13.0'
run: |
pip install -U pip
pip install -U setuptools wheel twine cffi
pip install -U setuptools wheel twine
- name: Build zope.hookable (macOS x86_64, Python 3.8+)
if: >
Expand Down Expand Up @@ -193,12 +206,9 @@ jobs:
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
run: |
# Install to collect dependencies into the (pip) cache.
# cffi will probably have no public release until a Python 3.13 beta
# or even RC release, see https://github.com/python-cffi/cffi/issues/23
echo "cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58" > cffi_constraint.txt
# Use "--pre" here because dependencies with support for this future
# Python release may only be available as pre-releases
PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre .[test]
pip install --pre .[test]
- name: Install zope.hookable and dependencies
if: matrix.python-version != '3.13.0-alpha - 3.13.0'
run: |
Expand Down Expand Up @@ -265,9 +275,9 @@ jobs:
- "3.11"
- "3.12"
- "3.13.0-alpha - 3.13.0"
os: [ubuntu-20.04, macos-11]
os: [ubuntu-latest, macos-latest, windows-latest]
exclude:
- os: macos-11
- os: macos-latest
python-version: "pypy-3.10"

steps:
Expand All @@ -283,15 +293,32 @@ jobs:
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
- name: Get pip cache dir (default)
id: pip-cache-default
if: ${{ !startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
- name: Get pip cache dir (Windows)
id: pip-cache-windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
- name: pip cache (default)
uses: actions/cache@v4
if: ${{ !startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache.outputs.dir }}
path: ${{ steps.pip-cache-default.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: pip cache (Windows)
uses: actions/cache@v4
if: ${{ startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-windows.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
Expand All @@ -301,14 +328,11 @@ jobs:
with:
name: zope.hookable-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install zope.hookable 3.13.0-alpha - 3.13.0
if: ${{ startsWith(matrix.python-version, '3.13.0-alpha - 3.13.0') }}
- name: Install zope.hookable 3.13.0-alpha - 3.13.0 ${{ matrix.python-version }}
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
run: |
pip install -U wheel setuptools
# cffi will probably have no public release until a beta or even RC
# version of Python 3.13, see https://github.com/python-cffi/cffi/issues/23
echo 'cffi @ git+https://github.com/python-cffi/cffi.git@954cab4f889fb019a7f90df153ee1be501495f58 ; platform_python_implementation == "CPython"' > cffi_constraint.txt
# coverage has a wheel on PyPI for a future python version which is
# coverage might have a wheel on PyPI for a future python version which is
# not ABI compatible with the current one, so build it from sdist:
pip install -U --no-binary :all: coverage
# Unzip into src/ so that testrunner can find the .so files
Expand All @@ -317,7 +341,7 @@ jobs:
unzip -n dist/zope.hookable-*whl -d src
# Use "--pre" here because dependencies with support for this future
# Python release may only be available as pre-releases
PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre -U -e .[test]
pip install --pre -U -e .[test]
- name: Install zope.hookable
if: ${{ !startsWith(matrix.python-version, '3.13.0-alpha - 3.13.0') }}
run: |
Expand All @@ -336,7 +360,9 @@ jobs:
- name: Run tests without C extensions
run:
# coverage makes PyPy run about 3x slower!
PURE_PYTHON=1 python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress
python -m coverage run -p -m zope.testrunner --test-path=src --auto-color --auto-progress
env:
PURE_PYTHON: 1
- name: Report Coverage
run: |
coverage combine
Expand All @@ -350,7 +376,7 @@ jobs:

coveralls_finish:
needs: test
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
Expand All @@ -363,7 +389,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04]
os: [ubuntu-latest]

steps:
- name: checkout
Expand All @@ -378,15 +404,32 @@ jobs:
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
- name: Get pip cache dir (default)
id: pip-cache-default
if: ${{ !startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
- name: Get pip cache dir (Windows)
id: pip-cache-windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
- name: pip cache (default)
uses: actions/cache@v4
if: ${{ !startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache.outputs.dir }}
path: ${{ steps.pip-cache-default.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: pip cache (Windows)
uses: actions/cache@v4
if: ${{ startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-windows.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
Expand Down Expand Up @@ -414,7 +457,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04]
os: [ubuntu-latest]

steps:
- name: checkout
Expand All @@ -429,15 +472,32 @@ jobs:
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
- name: Get pip cache dir (default)
id: pip-cache-default
if: ${{ !startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
- name: Get pip cache dir (Windows)
id: pip-cache-windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
- name: pip cache (default)
uses: actions/cache@v4
if: ${{ !startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-default.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: pip cache (Windows)
uses: actions/cache@v4
if: ${{ startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache.outputs.dir }}
path: ${{ steps.pip-cache-windows.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
Expand All @@ -461,7 +521,7 @@ jobs:
# python -m pylint --limit-inference-results=1 --rcfile=.pylintrc zope.hookable -f parseable -r n
manylinux:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
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:
Expand All @@ -482,15 +542,32 @@ jobs:
# to save the cache. So it must come before the thing we want to use
# the cache.
###
- name: Get pip cache dir
id: pip-cache
- name: Get pip cache dir (default)
id: pip-cache-default
if: ${{ !startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
- name: pip cache
- name: Get pip cache dir (Windows)
id: pip-cache-windows
if: ${{ startsWith(runner.os, 'Windows') }}
run: |
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
- name: pip cache (default)
uses: actions/cache@v4
if: ${{ !startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache-default.outputs.dir }}
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
- name: pip cache (Windows)
uses: actions/cache@v4
if: ${{ startsWith(runner.os, 'Windows') }}
with:
path: ${{ steps.pip-cache.outputs.dir }}
path: ${{ steps.pip-cache-windows.outputs.dir }}
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}
restore-keys: |
${{ runner.os }}-pip-
Expand Down Expand Up @@ -528,7 +605,7 @@ jobs:
path: wheelhouse/*whl
name: manylinux_${{ matrix.image }}_wheels.zip
- name: Restore pip cache permissions
run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }}
run: sudo chown -R $(whoami) ${{ steps.pip-cache-default.outputs.dir }}
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: >
Expand Down
4 changes: 2 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "1351c95d"
commit-id = "899fc875"

[python]
with-appveyor = true
with-windows = false
with-windows = true
with-pypy = true
with-future-python = true
with-docs = true
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

- Add preliminary support for Python 3.13 as of 3.13a5.

- Build windows wheels on GHA.

6.0 (2023-10-05)
================

Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include appveyor.yml
include .coveragerc

recursive-include docs *.py
Expand Down
Loading

0 comments on commit 2820fea

Please sign in to comment.