Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#112 Add windows to github actions #208

Merged
merged 11 commits into from
Mar 28, 2024
77 changes: 0 additions & 77 deletions config/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ The following options are only needed one time as their values are stored in
Define the configuration type (see `Types`_ section above) to be used for the
repository.

--with-appveyor
Enable running the tests on AppVeyor, too.

--with-macos
Enable running the tests on macOS on GitHub Actions.

Expand Down Expand Up @@ -204,7 +201,6 @@ updated. Example:
commit-id = "< commit-hash >"

[python]
with-appveyor = false
with-pypy = false
with-docs = true
with-sphinx-doctests = false
Expand Down Expand Up @@ -328,36 +324,6 @@ updated. Example:
"tox -f ${{ matrix.config[1] }}",
]

[appveyor]
global-env-vars = [
"ZOPE_INTERFACE_STRICT_IRO: 1",
]
additional-matrix = [
"- { PYTHON: 38, PURE_PYTHON: 1 }",
"- { PYTHON: 38-x64, PURE_PYTHON: 1 }",
]
install-steps = [
"- pip install zc.buildout",
"- buildout",
]
build-script = [
"- python -W ignore setup.py -q bdist_wheel",
]
test-steps = [
"- zope-testrunner --test-path=src",
"- jasmine",
]
additional-lines = [
"artifacts:",
" - path: 'dist\*.whl'",
" name: wheel",
]
replacement = [
"environment:",
" matrix:",
" ...",
]

[c-code]
manylinux-install-setup = [
"export CFLAGS=\"-pipe\"",
Expand Down Expand Up @@ -402,9 +368,6 @@ commit-id
Python options
``````````````

with-appveyor
Run the tests also on AppVeyor: true/false

with-macos
Run the tests also on macOS on GitHub Actions: true/false, default: false

Expand Down Expand Up @@ -636,46 +599,6 @@ test-commands
This option has to be a list of strings.


AppVeyor options
````````````````

The corresponding section is named: ``[appveyor]``.

global-env-vars
Environment variables to specify globally. This option has to be a list of
strings.

additional-matrix
Additional environment matrix rows. This option has to be a list of strings,
each starting with a ``-`` (unless you know what you're doing).

install-steps
Steps to install the package under test on AppVeyor. This option has to be a
list of strings. It defaults to ``["- pip install -U -e .[test]"]``.

build-script
Steps to to build the project. If this option is not given because no
additional build steps are necessary ``build: false`` is rendered to the
AppVeyor configuration. But if the config type is ``c-code`` it defaults to
``['- python -W ignore setup.py -q bdist_wheel']``. This option has to be a
list of strings, each one starting with a ``-``.

test-steps
Steps to run the tests on AppVeyor. This option has to be a list of strings
, each one starting with a ``-``. It defaults to
``["- zope-testrunner --test-path=src"]``.

additional-lines
This option allows to add arbitrary additional lines to the end of the
configuration file. It has to be a list of strings.

replacement
Replace the whole template of the AppVeyor configuration with the contents of
this option. Use this option as last resort if your needed changes are too
big to configure AppVeyor in another way. This option has to be a list of
strings.


C-code options
``````````````

Expand Down
1 change: 0 additions & 1 deletion config/buildout-recipe/packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ z3c.recipe.i18n
zc.recipe.cmmi
zdaemon
zc.recipe.filestorage
five.customerize
icemac marked this conversation as resolved.
Show resolved Hide resolved
z3c.recipe.compattest
zc.relation
zc.zodbrecipes
Expand Down
8 changes: 0 additions & 8 deletions config/c-code/appveyor-publish.j2

This file was deleted.

25 changes: 21 additions & 4 deletions config/c-code/tests-cache.j2
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,32 @@
# 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: %(cache_key)s
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: %(cache_key)s
restore-keys: |
${{ runner.os }}-pip-
4 changes: 4 additions & 0 deletions config/c-code/tests-strategy.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
{% if with_future_python %}
- "%(future_python_version)s"
{% endif %}
{% if with_windows %}
os: [ubuntu-20.04, macos-11, windows-latest]
{% else %}
os: [ubuntu-20.04, macos-11]
{% endif %}
{% if with_pypy or gha_additional_exclude %}
exclude:
{% endif %}
Expand Down
71 changes: 62 additions & 9 deletions config/c-code/tests.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,29 @@ jobs:
{% include 'tests-cache.j2' %}

{% if with_future_python %}
- name: Install Build Dependencies (%(future_python_version)s)
if: matrix.python-version == '%(future_python_version)s'
- name: Install Build Dependencies (%(future_python_version)s) - no Windows
if: >
matrix.python-version == '%(future_python_version)s'
&& !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=$PWD/cffi_constraint.txt pip install cffi
- name: Install Build Dependencies (%(future_python_version)s) - on Windows
if: >
matrix.python-version == '%(future_python_version)s'
&& 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
{% endif %}
- name: Install Build Dependencies
{% if with_future_python %}
Expand Down Expand Up @@ -162,8 +176,10 @@ jobs:
{% endfor %}

{% if with_future_python %}
- name: Install %(package_name)s and dependencies (%(future_python_version)s)
if: matrix.python-version == '%(future_python_version)s'
- name: Install %(package_name)s and dependencies (%(future_python_version)s) - no Windows
if: >
matrix.python-version == '%(future_python_version)s'
&& !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
Expand All @@ -172,6 +188,19 @@ jobs:
# 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]
- name: Install %(package_name)s and dependencies (%(future_python_version)s) - on Windows
if: >
matrix.python-version == '%(future_python_version)s'
&& 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]
{% endif %}
- name: Install %(package_name)s and dependencies
{% if with_future_python %}
Expand Down Expand Up @@ -254,8 +283,10 @@ jobs:
{% endfor %}
{% else %}
{% if with_future_python %}
- name: Install %(package_name)s %(future_python_version)s
if: ${{ startsWith(matrix.python-version, '%(future_python_version)s') }}
- name: Install %(package_name)s %(future_python_version)s ${{ matrix.python-version }}- no Windows
if: >
matrix.python-version == '%(future_python_version)s'
&& !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 @@ -271,6 +302,26 @@ jobs:
# 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]
- name: Install %(package_name)s %(future_python_version)s - on Windows
if: >
matrix.python-version == '%(future_python_version)s'
&& 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/%(package_name)s-*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]
{% endif %}
- name: Install %(package_name)s
{% if with_future_python %}
Expand Down Expand Up @@ -299,12 +350,14 @@ jobs:
run:
{% if gha_test_commands %}
{% for line in gha_test_commands %}
PURE_PYTHON=1 %(line)s
%(line)s
{% endfor %}
{% else %}
# 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
{% endif %}
env:
PURE_PYTHON: 1
- name: Report Coverage
run: |
coverage combine
Expand Down Expand Up @@ -423,7 +476,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
Loading