Skip to content

Commit

Permalink
Switch Windows builts to GHA (#291)
Browse files Browse the repository at this point in the history
* Skip another class behaving not as expected on PyPy for Windows.
  • Loading branch information
icemac committed Apr 18, 2024
1 parent 48e56f2 commit 78fdf3d
Show file tree
Hide file tree
Showing 9 changed files with 151 additions and 123 deletions.
173 changes: 129 additions & 44 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
uses: actions/cache@v3
- 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 @@ -140,16 +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
pip install -U "cffi @ https://github.com/python-cffi/cffi/archive/refs/heads/main.zip"
# twine has no release for 3.13, yet, see https://github.com/pypa/twine/issues/1030
pip install -U "git+https://github.com/pypa/twine.git#egg=twine"
- 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.interface (macOS x86_64, Python 3.8+)
if: >
Expand Down Expand Up @@ -263,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 @@ -281,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
uses: actions/cache@v3
- 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 @@ -312,12 +341,17 @@ jobs:
# might also save some build time?
unzip -n dist/zope.interface-*whl -d src
pip install -U -e .[test]
- name: Run tests and report coverage
# Once with C extensions, once without. Yes, this runs them
# twice on PyPy.
- name: Run tests with C extensions
if: ${{ !startsWith(matrix.python-version, 'pypy') }}
run: |
coverage run -p -m unittest discover -s src
PURE_PYTHON=1 coverage run -p -m unittest discover -s src
- name: Run tests without C extensions
run: |
coverage run -p -m unittest discover -s src
env:
PURE_PYTHON: 1
- name: Report Coverage
run: |
coverage combine
coverage report --ignore-errors --show-missing
- name: Submit to Coveralls
Expand All @@ -329,7 +363,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 @@ -342,7 +376,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04]
os: [ubuntu-latest]

steps:
- name: checkout
Expand All @@ -357,15 +391,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
uses: actions/cache@v3
- 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 @@ -393,7 +444,7 @@ jobs:
strategy:
matrix:
python-version: ["3.9"]
os: [ubuntu-20.04]
os: [ubuntu-latest]

steps:
- name: checkout
Expand All @@ -408,15 +459,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
uses: actions/cache@v3
- 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 @@ -440,7 +508,7 @@ jobs:
# python -m pylint --limit-inference-results=1 --rcfile=.pylintrc zope.interface -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 @@ -461,15 +529,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
uses: actions/cache@v3
- 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 @@ -507,7 +592,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
33 changes: 12 additions & 21 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# https://github.com/zopefoundation/meta/tree/master/config/c-code
[meta]
template = "c-code"
commit-id = "e45966cd"
commit-id = "3a81d045"

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

[tox]
use-flake8 = false
use-flake8 = true
testenv-commands = [
"coverage run -p -m unittest discover -s src {posargs}",
]
Expand Down Expand Up @@ -69,26 +69,17 @@ additional-install = [
" # might also save some build time?",
" unzip -n dist/zope.interface-*whl -d src",
" pip install -U -e .[test]",
"- name: Run tests and report coverage",
" # Once with C extensions, once without. Yes, this runs them",
" # twice on PyPy.",
"- name: Run tests with C extensions",
" if: ${{ !startsWith(matrix.python-version, 'pypy') }}",
" run: |",
" coverage run -p -m unittest discover -s src",
" PURE_PYTHON=1 coverage run -p -m unittest discover -s src",
"- name: Run tests without C extensions",
" run: |",
" coverage run -p -m unittest discover -s src",
" env:",
" PURE_PYTHON: 1",
"- name: Report Coverage",
" run: |",
" coverage combine",
" coverage report --ignore-errors --show-missing",
]

[appveyor]
global-env-vars = [
"# Currently the builds use @mgedmin's Appveyor account. The PyPI token",
"# belongs to zope.wheelbuilder, which is managed by @mgedmin and @dataflake.",
"",
"global:",
" TWINE_USERNAME: __token__",
" TWINE_PASSWORD:",
" secure: aoZC/+rvJKg8B5GMGIxd1X2q2bz7SMl8G3810BID9U8PXFqM0FbWaK9fZ9qcU0UyG2xJsK56Fb6+L6g27I0Lg8UFNhlU1zLAuMSgJQbHsqawFgSY067IdJB68pp34d/oEyxMrJvAKENHH77Fe4KGDssLlk5WnnYS3DA9b66p5imP+1DTtkq5/gMtoG4nZTBtVos7J2kkYTQ5t4BjzTQxPMC3bStNnvuuB0orX4AoCyTrOR1wdZFiNKLzbVnrJCNn24t/n3kG9WrxbnKlrbOm4A==",
]
test-steps = [
"- python -m unittest discover -s src",
]
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
6.4 (unreleased)
================

- Build windows wheels on GHA.

6.3 (2024-04-12)
================
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 78fdf3d

Please sign in to comment.