From bf1db7a276c3fc010dc374bd12adf6fda4bf28b9 Mon Sep 17 00:00:00 2001 From: Jeremy Kolbe Date: Fri, 22 Sep 2023 16:14:36 +0200 Subject: [PATCH] #112 Add windows to github actions --- config/c-code/tests-cache.j2 | 25 +++++++++++++++++++++---- config/c-code/tests-strategy.j2 | 2 +- config/c-code/tests.yml.j2 | 8 +++++--- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/config/c-code/tests-cache.j2 b/config/c-code/tests-cache.j2 index d475fd4..695eebf 100644 --- a/config/c-code/tests-cache.j2 +++ b/config/c-code/tests-cache.j2 @@ -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: 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 + - name: pip cache (default) + uses: actions/cache@v3 + 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@v3 + 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- diff --git a/config/c-code/tests-strategy.j2 b/config/c-code/tests-strategy.j2 index 8d4ede1..f53fb9e 100644 --- a/config/c-code/tests-strategy.j2 +++ b/config/c-code/tests-strategy.j2 @@ -13,7 +13,7 @@ {% if with_future_python %} - "%(future_python_version)s" {% endif %} - os: [ubuntu-20.04, macos-11] + os: [ubuntu-20.04, macos-11, windows-latest] {% if with_pypy or gha_additional_exclude %} exclude: {% endif %} diff --git a/config/c-code/tests.yml.j2 b/config/c-code/tests.yml.j2 index 32557a1..efcf8be 100644 --- a/config/c-code/tests.yml.j2 +++ b/config/c-code/tests.yml.j2 @@ -279,12 +279,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 @@ -403,7 +405,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: >