Skip to content

Add Python 3.13 support #287

Add Python 3.13 support

Add Python 3.13 support #287

Workflow file for this run

name: CI
on:
push:
branches: [ trunk ]
pull_request:
branches: [ trunk ]
jobs:
lint:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key:
${{ runner.os }}-pip-lint-${{ hashFiles('pyproject.toml', 'setup.py', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-lint-
${{ runner.os }}-pip-
- run: python -m pip install 'tox<4'
- run: tox -q -p all -e flake8,towncrier,twine,check-manifest,mypy
env:
TOX_PARALLEL_NO_SPINNER: 1
docs:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key:
${{ runner.os }}-pip-docs-${{ hashFiles('pyproject.toml', 'setup.py', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-docs-
${{ runner.os }}-pip-
- run: python -m pip install 'tox<4'
- run: tox -q -e docs
test:
name: "Test ${{ matrix.python-version }} with ${{ matrix.twisted-version }} Twisted"
runs-on: ubuntu-22.04
timeout-minutes: 10
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
# Python versions common to lowest and latest
python-version: ["3.8", "3.9", "3.10", "pypy-3.9"]
twisted-version: ["lowest", "latest"]
experimental: [false]
include:
# Pythons too new for lowest
- python-version: "3.11"
twisted-version: "latest"
experimental: false
- python-version: "3.12"
twisted-version: "latest"
experimental: false
- python-version: "3.13-dev"
twisted-version: "latest"
experimental: true
- python-version: "pypy-3.10"
twisted-version: "latest"
experimental: false
# Experimental trunk build
- python-version: "3.9"
twisted-version: "trunk"
experimental: true
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key:
${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'setup.py', 'tox.ini') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
- name: Translate Python version to Tox factor
id: pyfactor
shell: python
run: |
table = {
"3.8": "py38",
"3.9": "py39",
"3.10": "py310",
"3.11": "py311",
"3.12": "py312",
"3.13-dev": "py313",
"pypy-3.8": "pypy3",
"pypy-3.9": "pypy3",
"pypy-3.10": "pypy3",
}
factor = table["${{ matrix.python-version }}"]
print("::set-output name=value::" + factor)
- run: python -m pip install tox coveralls
- run: tox -e ${{ steps.pyfactor.outputs.value }}-twisted_${{ matrix.twisted-version }}
- run: coveralls
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_REPO_TOKEN: 4nctuKHTnVtbdmty2FgdO3iiWm1nb7xc4
COVERALLS_FLAG_NAME: python_${{ matrix.python-version }}-twisted_${{ matrix.twisted-version }}
COVERALLS_PARALLEL: true
# Helper so that on GitHub repo settings we can configure to single job.
# Then required jobs can be updated directly form the code,
# without having to go the GitHub repo setting -> Protected branch
# and all the clicking.
treq-required:
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ !cancelled() }}
# Add here the jobs that should block the merge of a PR.
needs:
- lint
- docs
- test
steps:
- name: Require all successes
shell: python3 {0}
env:
RESULTS: ${{ toJSON(needs.*.result) }}
run: |
import json
import os
import sys
results = json.loads(os.environ["RESULTS"])
sys.exit(0 if all(result == "success" for result in results) else 1)