Skip to content

chore(ci): fix test workflow to handle EOL pythons #42

chore(ci): fix test workflow to handle EOL pythons

chore(ci): fix test workflow to handle EOL pythons #42

Workflow file for this run

name: Tests
on:
push:
branches: ["*"]
pull_request:
branches: [main]
jobs:
tests:
name: Python ${{ matrix.python }} ${{ matrix.os }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12", pypy3.8, pypy3.10]
include:
- {python: "3.6", os: ubuntu-20.04, tox3: true}
- {python: "3.7", tox3: true}
- {python: pypy2.7, tox3: true}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ matrix.python }}
- run: python -m pip install --upgrade pip setuptools
- name: Install tox4
run: pip install tox
if: ${{ ! matrix.tox3 }}
- name: Install tox3
run: pip install 'tox<4' 'virtualenv<20.22.0'
if: ${{ matrix.tox3 }}
- name: Compute tox env name
run: |
toxenv=$(python -c '
ver=r"${{ matrix.python }}".replace(".", "")
print("py" + ver if ver[0].isdigit() else ver)
')
echo toxenv is "$toxenv";
echo "TOXENV=$toxenv" >> "$GITHUB_ENV"
- name: Test with tox
run: tox
- uses: actions/upload-artifact@v4
with:
name: coverage-data-${{ matrix.python }}
path: .coverage.*
include-hidden-files: true
test-py27:
name: Python 2.7
runs-on: ubuntu-latest
container: python:2.7-buster
steps:
- uses: actions/checkout@v4
- run: python -m pip install --upgrade pip setuptools
- name: Install tox3
run: pip install 'tox<4' 'virtualenv<20.22.0'
- name: Test with tox
run: tox -e py27
- uses: actions/upload-artifact@v4
with:
name: coverage-data-2.7
path: .coverage.*
include-hidden-files: true
coverage:
needs: [tests, test-py27]
if: ${{ success() || failure() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: coverage-data-*
merge-multiple: true
- run: python -m pip install tox
- run: tox -e cover-report
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: python -m pip install pre-commit tox
- run: pre-commit run -a
- run: tox r -e lint
if: ${{ success() || failure() }}