Skip to content

Commit 197abbf

Browse files
committed
Work around py27 unsupported on GH actions
actions/setup-python#672
1 parent 6ea95cb commit 197abbf

File tree

1 file changed

+68
-8
lines changed

1 file changed

+68
-8
lines changed

.github/workflows/plone-package.yml

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
python-version: ['2.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
18+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
1919
steps:
2020
- name: Git checkout
2121
uses: actions/checkout@v4
@@ -40,22 +40,18 @@ jobs:
4040
env:
4141
PLATFORM: lint
4242

43-
build_and_test:
43+
build_and_test_py3:
4444
runs-on: ubuntu-latest
4545
strategy:
4646
fail-fast: false
4747
matrix:
48-
python-version: ['2.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
48+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
4949
plone-version: ['Plone52', 'Plone60', 'Plone61']
5050
# While tox skips invalid matrix combinations, Github actions does
5151
# schedule and fail jobs for these. So exclude them. We could also
5252
# use include instead, but then the job names do not contain the
5353
# Plone version.
5454
exclude:
55-
- python-version: '2.7'
56-
plone-version: 'Plone60'
57-
- python-version: '2.7'
58-
plone-version: 'Plone61'
5955
- python-version: '3.8'
6056
plone-version: 'Plone60'
6157
- python-version: '3.8'
@@ -128,10 +124,74 @@ jobs:
128124
include-hidden-files: true
129125
if-no-files-found: ignore
130126

127+
# https://github.com/actions/setup-python/issues/672#issuecomment-1589120020
128+
build_and_test_py2:
129+
runs-on: ubuntu-20.04
130+
container:
131+
image: python:2.7.18-buster
132+
strategy:
133+
fail-fast: false
134+
matrix:
135+
python-version: ['2.7']
136+
plone-version: ['Plone52']
137+
138+
steps:
139+
- name: Git checkout
140+
uses: actions/checkout@v4
141+
142+
- name: Set up Python ${{ matrix.python-version }}
143+
uses: actions/setup-python@v5
144+
with:
145+
python-version: ${{ matrix.python-version }}
146+
147+
- name: Cache hash ${{ matrix.python-version }} - ${{ matrix.plone-version }}
148+
uses: actions/cache@v4
149+
with:
150+
path: |
151+
~/.cache/pip
152+
~/buildout-cache
153+
~/extends
154+
key: ${{ runner.os }}-tox-${{ matrix.python-version }}-${{ matrix.plone-version }}-${{ hashFiles('**/setup.py') }}-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/*.cfg') }}-${{ hashFiles('**/constraints.txt') }}-${{ hashFiles('**/tox.ini') }}
155+
#restore-keys: |
156+
# ${{ runner.os }}-tox-
157+
158+
- name: Cache configure
159+
run: |
160+
mkdir -p ~/buildout-cache/{eggs,downloads}
161+
mkdir ~/.buildout
162+
echo "[buildout]" > $HOME/.buildout/default.cfg
163+
echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg
164+
echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg
165+
166+
- name: Install dependencies
167+
run: |
168+
python -m pip install --upgrade pip
169+
pip install tox tox-gh-actions
170+
171+
# Unfortunately, this is always also run against python3.10 in
172+
# addition to the specified python factor, if the plone version is
173+
# supported on 3.10. Apparently that (base?) version is always
174+
# available.
175+
- name: Test with tox
176+
run: |
177+
tox -r
178+
env:
179+
PLONE_VERSION: ${{ matrix.plone-version }}
180+
181+
# Coverage, based on https://hynek.me/articles/ditch-codecov-python/
182+
183+
- name: Upload coverage data
184+
uses: actions/upload-artifact@v4
185+
with:
186+
name: coverage-data-${{ matrix.python-version }}-${{ matrix.plone-version }}
187+
path: .coverage.*
188+
include-hidden-files: true
189+
if-no-files-found: ignore
190+
131191
coverage:
132192
name: Combine & check coverage
133193
if: always()
134-
needs: build_and_test
194+
needs: build_and_test_py3
135195
runs-on: ubuntu-latest
136196

137197
steps:

0 commit comments

Comments
 (0)