From c379ccb45af0779cea5999086fa1df29392c4eb0 Mon Sep 17 00:00:00 2001 From: Paul Ganssle Date: Tue, 16 Sep 2025 10:06:28 +0100 Subject: [PATCH] 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. --- .github/workflows/tests.yml | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ca0ca1a..f8e910f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,26 +18,18 @@ jobs: os: ["ubuntu-latest", "windows-latest", "macos-latest"] exclude: - python-version: "2.7" - os: "windows-latest" - - python-version: "2.7" - os: "macos-latest" - - python-version: "2.7" - os: "ubuntu-latest" include: - python-version: "2.7" - os: "ubuntu-20.04" + os: "ubuntu-latest" + use-container: true env: TOXENV: py - + container: + image: ${{ matrix.use-container && format('python:{0}', matrix.python-version) || '' }} steps: - uses: actions/checkout@v5 - - if: ${{ matrix.python-version == '2.7' }} - run: | - sudo apt-get install python-is-python2 - curl -sSL https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py - python get-pip.py - - if: ${{ matrix.python-version != '2.7' }} - name: ${{ matrix.python-version }} - ${{ matrix.os }} + - if: ${{ !matrix.use-container }} + name: Set up Python ${{ matrix.python-version }} on ${{ matrix.os }} (non-containers) uses: actions/setup-python@v6 with: python-version: ${{ matrix.python-version }}