Skip to content

Commit cfcb574

Browse files
committed
Fix pypy-3.11, windows GHA runs
1 parent 1e6873d commit cfcb574

4 files changed

Lines changed: 77 additions & 93 deletions

File tree

.github/workflows/pre-commit.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
name: linting
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v6
25-
- uses: actions/setup-python@v6
24+
- uses: actions/checkout@v7
25+
- uses: actions/setup-python@v7
2626
with:
2727
python-version: '3.13'
2828
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #v3.0.1

.github/workflows/tests.yml

Lines changed: 73 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ on:
4646
# Allow to run this workflow manually from the Actions tab
4747
workflow_dispatch:
4848

49+
defaults:
50+
run:
51+
# ``pwsh`` propagates only the exit code of the *last* command of a
52+
# multi-command block, so failures on Windows go unnoticed. ``bash``
53+
# runs with ``-eo pipefail`` and aborts the step on the first failure.
54+
shell: bash
55+
4956
env:
5057
# Weirdly, this has to be a top-level key, not ``defaults.env``
5158
PYTHONHASHSEED: 8675309
@@ -106,11 +113,11 @@ jobs:
106113

107114
steps:
108115
- name: checkout
109-
uses: actions/checkout@v6
116+
uses: actions/checkout@v7
110117
with:
111118
persist-credentials: false
112119
- name: Set up Python ${{ matrix.python-version }}
113-
uses: actions/setup-python@v6
120+
uses: actions/setup-python@v7
114121
with:
115122
python-version: ${{ matrix.python-version }}
116123
allow-prereleases: true
@@ -120,42 +127,36 @@ jobs:
120127
# to save the cache. So it must come before the thing we want to use
121128
# the cache.
122129
###
123-
- name: Get pip cache dir (default)
124-
id: pip-cache-default
125-
if: ${{ !startsWith(runner.os, 'Windows') }}
130+
- name: Get pip cache epoch
131+
id: pip-cache-epoch
132+
# ``actions/cache`` never replaces an entry: "if the provided key
133+
# matches an existing cache, a new cache is not created". A corrupt
134+
# entry would therefore break every run that restores it until GitHub
135+
# evicts it. Rotating the key weekly abandons such an entry instead.
126136
run: |
127-
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
137+
echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT"
128138
129-
- name: Get pip cache dir (Windows)
130-
id: pip-cache-windows
131-
if: ${{ startsWith(runner.os, 'Windows') }}
139+
- name: Get pip cache dir
140+
id: pip-cache
132141
run: |
133-
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
134-
135-
- name: pip cache (default)
136-
uses: actions/cache@v5
137-
if: ${{ !startsWith(runner.os, 'Windows') }}
138-
with:
139-
path: ${{ steps.pip-cache-default.outputs.dir }}
140-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}
142+
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT"
141143
142-
- name: pip cache (Windows)
144+
- name: pip cache
143145
uses: actions/cache@v5
144-
if: ${{ startsWith(runner.os, 'Windows') }}
145146
with:
146-
path: ${{ steps.pip-cache-windows.outputs.dir }}
147-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}
147+
path: ${{ steps.pip-cache.outputs.dir }}
148+
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }}
148149

149150

150151
- name: Install Build Dependencies (3.15)
151152
if: startsWith(matrix.python-version, '3.15')
152153
run: |
153-
pip install -U pip
154+
python -m pip install -U pip
154155
pip install -U "setuptools >= 78.1.1,< 82" wheel twine cffi pycparser
155156
- name: Install Build Dependencies
156157
if: ${{ !startsWith(matrix.python-version, '3.15') }}
157158
run: |
158-
pip install -U pip
159+
python -m pip install -U pip
159160
pip install -U "setuptools >= 78.1.1,< 82" wheel twine
160161
161162
- name: Build Persistence (macOS x86_64)
@@ -212,7 +213,7 @@ jobs:
212213
if: ${{ !startsWith(matrix.python-version, '3.15') }}
213214
run: |
214215
# Install to collect dependencies into the (pip) cache.
215-
pip install -U pip "setuptools >= 78.1.1,< 82"
216+
python -m pip install -U pip "setuptools >= 78.1.1,< 82"
216217
pip install .[test]
217218
218219
- name: Check Persistence build
@@ -285,11 +286,11 @@ jobs:
285286

286287
steps:
287288
- name: checkout
288-
uses: actions/checkout@v6
289+
uses: actions/checkout@v7
289290
with:
290291
persist-credentials: false
291292
- name: Set up Python ${{ matrix.python-version }}
292-
uses: actions/setup-python@v6
293+
uses: actions/setup-python@v7
293294
with:
294295
python-version: ${{ matrix.python-version }}
295296
allow-prereleases: true
@@ -299,31 +300,25 @@ jobs:
299300
# to save the cache. So it must come before the thing we want to use
300301
# the cache.
301302
###
302-
- name: Get pip cache dir (default)
303-
id: pip-cache-default
304-
if: ${{ !startsWith(runner.os, 'Windows') }}
303+
- name: Get pip cache epoch
304+
id: pip-cache-epoch
305+
# ``actions/cache`` never replaces an entry: "if the provided key
306+
# matches an existing cache, a new cache is not created". A corrupt
307+
# entry would therefore break every run that restores it until GitHub
308+
# evicts it. Rotating the key weekly abandons such an entry instead.
305309
run: |
306-
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
310+
echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT"
307311
308-
- name: Get pip cache dir (Windows)
309-
id: pip-cache-windows
310-
if: ${{ startsWith(runner.os, 'Windows') }}
312+
- name: Get pip cache dir
313+
id: pip-cache
311314
run: |
312-
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
313-
314-
- name: pip cache (default)
315-
uses: actions/cache@v5
316-
if: ${{ !startsWith(runner.os, 'Windows') }}
317-
with:
318-
path: ${{ steps.pip-cache-default.outputs.dir }}
319-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}
315+
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT"
320316
321-
- name: pip cache (Windows)
317+
- name: pip cache
322318
uses: actions/cache@v5
323-
if: ${{ startsWith(runner.os, 'Windows') }}
324319
with:
325-
path: ${{ steps.pip-cache-windows.outputs.dir }}
326-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}
320+
path: ${{ steps.pip-cache.outputs.dir }}
321+
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }}
327322

328323
- name: Download Persistence wheel (Linux/macOS)
329324
if: "!startsWith(runner.os, 'Windows')"
@@ -405,11 +400,11 @@ jobs:
405400

406401
steps:
407402
- name: checkout
408-
uses: actions/checkout@v6
403+
uses: actions/checkout@v7
409404
with:
410405
persist-credentials: false
411406
- name: Set up Python ${{ matrix.python-version }}
412-
uses: actions/setup-python@v6
407+
uses: actions/setup-python@v7
413408
with:
414409
python-version: ${{ matrix.python-version }}
415410
allow-prereleases: true
@@ -419,31 +414,25 @@ jobs:
419414
# to save the cache. So it must come before the thing we want to use
420415
# the cache.
421416
###
422-
- name: Get pip cache dir (default)
423-
id: pip-cache-default
424-
if: ${{ !startsWith(runner.os, 'Windows') }}
417+
- name: Get pip cache epoch
418+
id: pip-cache-epoch
419+
# ``actions/cache`` never replaces an entry: "if the provided key
420+
# matches an existing cache, a new cache is not created". A corrupt
421+
# entry would therefore break every run that restores it until GitHub
422+
# evicts it. Rotating the key weekly abandons such an entry instead.
425423
run: |
426-
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
424+
echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT"
427425
428-
- name: Get pip cache dir (Windows)
429-
id: pip-cache-windows
430-
if: ${{ startsWith(runner.os, 'Windows') }}
426+
- name: Get pip cache dir
427+
id: pip-cache
431428
run: |
432-
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
429+
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT"
433430
434-
- name: pip cache (default)
431+
- name: pip cache
435432
uses: actions/cache@v5
436-
if: ${{ !startsWith(runner.os, 'Windows') }}
437433
with:
438-
path: ${{ steps.pip-cache-default.outputs.dir }}
439-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}
440-
441-
- name: pip cache (Windows)
442-
uses: actions/cache@v5
443-
if: ${{ startsWith(runner.os, 'Windows') }}
444-
with:
445-
path: ${{ steps.pip-cache-windows.outputs.dir }}
446-
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}
434+
path: ${{ steps.pip-cache.outputs.dir }}
435+
key: ${{ runner.os }}-${{ runner.arch }}-pip-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }}
447436

448437
- name: Download Persistence wheel
449438
uses: actions/download-artifact@v8
@@ -479,11 +468,11 @@ jobs:
479468
python-version: "3.13"
480469
steps:
481470
- name: checkout
482-
uses: actions/checkout@v6
471+
uses: actions/checkout@v7
483472
with:
484473
persist-credentials: false
485474
- name: Set up Python ${{ matrix.python-version }}
486-
uses: actions/setup-python@v6
475+
uses: actions/setup-python@v7
487476
with:
488477
python-version: ${{ matrix.python-version }}
489478
allow-prereleases: true
@@ -493,35 +482,29 @@ jobs:
493482
# to save the cache. So it must come before the thing we want to use
494483
# the cache.
495484
###
496-
- name: Get pip cache dir (default)
497-
id: pip-cache-default
498-
if: ${{ !startsWith(runner.os, 'Windows') }}
485+
- name: Get pip cache epoch
486+
id: pip-cache-epoch
487+
# ``actions/cache`` never replaces an entry: "if the provided key
488+
# matches an existing cache, a new cache is not created". A corrupt
489+
# entry would therefore break every run that restores it until GitHub
490+
# evicts it. Rotating the key weekly abandons such an entry instead.
499491
run: |
500-
echo "dir=$(pip cache dir)" >>$GITHUB_OUTPUT
492+
echo "week=$(date -u +%G-%V)" >> "$GITHUB_OUTPUT"
501493
502-
- name: Get pip cache dir (Windows)
503-
id: pip-cache-windows
504-
if: ${{ startsWith(runner.os, 'Windows') }}
494+
- name: Get pip cache dir
495+
id: pip-cache
505496
run: |
506-
echo "dir=$(pip cache dir)" >> $Env:GITHUB_OUTPUT
507-
508-
- name: pip cache (default)
509-
uses: actions/cache@v5
510-
if: ${{ !startsWith(runner.os, 'Windows') }}
511-
with:
512-
path: ${{ steps.pip-cache-default.outputs.dir }}
513-
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}
497+
echo "dir=$(pip cache dir)" >> "$GITHUB_OUTPUT"
514498
515-
- name: pip cache (Windows)
499+
- name: pip cache
516500
uses: actions/cache@v5
517-
if: ${{ startsWith(runner.os, 'Windows') }}
518501
with:
519-
path: ${{ steps.pip-cache-windows.outputs.dir }}
520-
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}
502+
path: ${{ steps.pip-cache.outputs.dir }}
503+
key: ${{ runner.os }}-pip_manylinux-${{ matrix.image }}-${{ matrix.python-version }}-${{ steps.pip-cache-epoch.outputs.week }}
521504

522505

523506
- name: Update pip
524-
run: pip install -U pip
507+
run: python -m pip install -U pip
525508

526509
- name: Build Persistence
527510
if: matrix.image != 'manylinux2014_i686'
@@ -547,7 +530,7 @@ jobs:
547530
name: manylinux_${{ matrix.image }}_wheels.zip
548531

549532
- name: Restore pip cache permissions
550-
run: sudo chown -R $(whoami) ${{ steps.pip-cache-default.outputs.dir }}
533+
run: sudo chown -R $(whoami) ${{ steps.pip-cache.outputs.dir }}
551534

552535
- name: Prevent publishing wheels for unreleased Python versions
553536
run: VER=$(echo '3.15' | tr -d .) && ls -al wheelhouse && sudo rm -f wheelhouse/*-cp${VER}*.whl && ls -al wheelhouse
@@ -592,7 +575,7 @@ jobs:
592575
find dist/ -name "*linux_x86_64*" -type f -delete || true
593576
594577
- name: Publish to PyPI
595-
uses: pypa/gh-action-pypi-publish@release/v1
578+
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
596579
with:
597580
skip-existing: true
598581
packages-dir: dist/

.meta.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# https://github.com/zopefoundation/meta/tree/master/src/zope/meta/c-code
33
[meta]
44
template = "c-code"
5-
commit-id = "fee4a500"
5+
commit-id = "a302ef7f"
66

77
[python]
88
with-windows = true

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,5 @@ readme = {file = ["README.rst", "CHANGES.rst"]}
8787

8888
[tool.zest-releaser]
8989
create-wheel = false
90+
extra-message = ""
9091
upload-pypi = false

0 commit comments

Comments
 (0)