Skip to content

Commit 4223f7a

Browse files
committed
Use a container for Python 2.7
The runner for Ubuntu that supports Python 2.7 is no longer supported, but we can still access older Pythons by using a container.
1 parent 2319e69 commit 4223f7a

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

.github/workflows/tests.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,18 @@ jobs:
1818
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
1919
exclude:
2020
- python-version: "2.7"
21-
os: "windows-latest"
22-
- python-version: "2.7"
23-
os: "macos-latest"
24-
- python-version: "2.7"
25-
os: "ubuntu-latest"
2621
include:
2722
- python-version: "2.7"
28-
os: "ubuntu-20.04"
23+
os: "ubuntu-latest"
24+
use-container: true
2925
env:
3026
TOXENV: py
31-
27+
container:
28+
image: ${{ matrix.use-container && format('python:{0}', matrix.python-version) || '' }}
3229
steps:
3330
- uses: actions/checkout@v5
34-
- if: ${{ matrix.python-version == '2.7' }}
35-
run: |
36-
sudo apt-get install python-is-python2
37-
curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
38-
python get-pip.py
39-
- if: ${{ matrix.python-version != '2.7' }}
40-
name: ${{ matrix.python-version }} - ${{ matrix.os }}
31+
- if: ${{ !matrix.use-container }}
32+
name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} (non-containers)
4133
uses: actions/setup-python@v6
4234
with:
4335
python-version: ${{ matrix.python-version }}

0 commit comments

Comments
 (0)