Skip to content

Commit

Permalink
Switch Windows builds to GHA (#72)
Browse files Browse the repository at this point in the history
Co-authored-by: Jens Vagelpohl <[email protected]>
  • Loading branch information
icemac and dataflake authored Mar 28, 2024
1 parent 6e5b390 commit fa5c6a8
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 89 deletions.
179 changes: 150 additions & 29 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13.0-alpha - 3.13.0"
os: [ubuntu-20.04, macos-11]
os: [ubuntu-20.04, macos-11, windows-latest]
exclude:
- os: macos-11
python-version: "pypy-3.10"
Expand All @@ -122,28 +122,59 @@ 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: Install Build Dependencies (3.13.0-alpha - 3.13.0)
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
- 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-
- name: Install Build Dependencies (3.13.0-alpha - 3.13.0) - no Windows
if: >
matrix.python-version == '3.13.0-alpha - 3.13.0'
&& !startsWith(runner.os, 'Windows')
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=cffi_constraint.txt pip install cffi
PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install cffi
- name: Install Build Dependencies (3.13.0-alpha - 3.13.0) - on Windows
if: >
matrix.python-version == '3.13.0-alpha - 3.13.0'
&& startsWith(runner.os, 'Windows')
run: |
# 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
set PIP_CONSTRAINT=%cd%\cffi_constraint.txt
pip install cffi
pip install -U pip
pip install -U setuptools wheel twine
- name: Install Build Dependencies
if: matrix.python-version != '3.13.0-alpha - 3.13.0'
run: |
Expand Down Expand Up @@ -189,16 +220,31 @@ jobs:
python setup.py build_ext -i
python setup.py bdist_wheel
- name: Install ExtensionClass and dependencies (3.13.0-alpha - 3.13.0)
if: matrix.python-version == '3.13.0-alpha - 3.13.0'
- name: Install ExtensionClass and dependencies (3.13.0-alpha - 3.13.0) - no Windows
if: >
matrix.python-version == '3.13.0-alpha - 3.13.0'
&& !startsWith(runner.os, 'Windows')
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=cffi_constraint.txt pip install --pre .[test]
PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre .[test]
- name: Install ExtensionClass and dependencies (3.13.0-alpha - 3.13.0) - on Windows
if: >
matrix.python-version == '3.13.0-alpha - 3.13.0'
&& startsWith(runner.os, 'Windows')
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
set PIP_CONSTRAINT=%cd%\cffi_constraint.txt
pip install --pre .[test]
- name: Install ExtensionClass and dependencies
if: matrix.python-version != '3.13.0-alpha - 3.13.0'
run: |
Expand Down Expand Up @@ -265,7 +311,7 @@ jobs:
- "3.11"
- "3.12"
- "3.13.0-alpha - 3.13.0"
os: [ubuntu-20.04, macos-11]
os: [ubuntu-20.04, macos-11, windows-latest]
exclude:
- os: macos-11
python-version: "pypy-3.10"
Expand All @@ -283,15 +329,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 @@ -301,8 +364,10 @@ jobs:
with:
name: ExtensionClass-${{ runner.os }}-${{ matrix.python-version }}.whl
path: dist/
- name: Install ExtensionClass 3.13.0-alpha - 3.13.0
if: ${{ startsWith(matrix.python-version, '3.13.0-alpha - 3.13.0') }}
- name: Install ExtensionClass 3.13.0-alpha - 3.13.0 ${{ matrix.python-version }}- no Windows
if: >
matrix.python-version == '3.13.0-alpha - 3.13.0'
&& !startsWith(runner.os, 'Windows')
run: |
pip install -U wheel setuptools
# cffi will probably have no public release until a beta or even RC
Expand All @@ -317,7 +382,27 @@ jobs:
unzip -n dist/ExtensionClass-*whl -d src
# Use "--pre" here because dependencies with support for this future
# Python release may only be available as pre-releases
PIP_CONSTRAINT=cffi_constraint.txt pip install --pre -U -e .[test]
PIP_CONSTRAINT=$PWD/cffi_constraint.txt pip install --pre -U -e .[test]
- name: Install ExtensionClass 3.13.0-alpha - 3.13.0 - on Windows
if: >
matrix.python-version == '3.13.0-alpha - 3.13.0'
&& startsWith(runner.os, 'Windows')
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
# 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
# when we ask it to load tests from that directory. This
# might also save some build time?
unzip -n dist/ExtensionClass-*whl -d src
# Use "--pre" here because dependencies with support for this future
# Python release may only be available as pre-releases
set PIP_CONSTRAINT=%cd%\cffi_constraint.txt
pip install --pre -U -e .[test]
- name: Install ExtensionClass
if: ${{ !startsWith(matrix.python-version, '3.13.0-alpha - 3.13.0') }}
run: |
Expand All @@ -336,7 +421,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 Down Expand Up @@ -378,15 +465,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 Down Expand Up @@ -431,15 +535,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 @@ -477,7 +598,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
6 changes: 3 additions & 3 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "fc37b50c"
commit-id = "32bb1a75"

[python]
with-appveyor = true
with-windows = false
with-windows = true
with-pypy = true
with-sphinx-doctests = false
with-future-python = true
with-macos = false
with-docs = false

[tox]
use-flake8 = true
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
5.2 (unreleased)
================

- Add preliminary support for Python 3.13a3.
- Add preliminary support for Python 3.13a5.

- Build Windows wheels on GHA.


5.1 (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 src *.py
Expand Down
53 changes: 0 additions & 53 deletions appveyor.yml

This file was deleted.

2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[bdist_wheel]
universal = 0

[zest.releaser]
create-wheel = no
Expand Down

0 comments on commit fa5c6a8

Please sign in to comment.