Skip to content

Commit

Permalink
Define all matrix jobs via include.
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Aug 30, 2022
1 parent a7bb10e commit 07a8125
Showing 1 changed file with 56 additions and 33 deletions.
89 changes: 56 additions & 33 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,29 +31,34 @@ defaults:
env:
# Set to 'yes' to open a tunnel to GitHub's VMs through tmate on failures.
TMATE_DEBUG: 'no'
# The default values in the job generated by the matrix.
DEFAULT_JOB_NAME: 'lnx-default-tests'
DEFAULT_PYTHON_VERSION: '3.10'
DEFAULT_RUNS_ON: 'ubuntu-20.04'
DEFAULT_TOX_ENV: 'alldeps-withcov-posix'
DEFAULT_TRIAL_ARGS: '-j 4'

jobs:
testing:
name: ${{ matrix.python-version }}-${{ matrix.job-name || 'lnx-default-tests' }}
name: ${{ matrix.python-version || env.DEFAULT_PYTHON_VERSION }}-${{ matrix.job-name || env.DEFAULT_JOB_NAME }}
# We have Ubuntu as the base for running agains multiple Python versions.
runs-on: "${{ matrix.runs-on || 'ubuntu-20.04'}}"
runs-on: "${{ matrix.runs-on || env.DEFAULT_RUNS_ON }}"
env:
# By default we run all tests with all deps with coverage.
TOXENV: "${{ matrix.tox-env || 'alldeps-withcov-posix' }}"
TOXENV: "${{ matrix.tox-env || env.DEFAULT_TOX_ENV }}"
# As of April 2021 GHA VM have 2 CPUs - Azure Standard_DS2_v2
# Trial distributed jobs enabled to speed up the CI jobs.
# On Windows, we don't yet enable distributed tests as is not yet
# supported.
TRIAL_ARGS: "${{ matrix.trial-args || '-j 4' }}"
TRIAL_ARGS: "${{ matrix.trial-args || env.DEFAULT_TRIAL_ARGS }}"
strategy:
fail-fast: false
# The matrix is designed to run by default various Python versions with
# the default OS and tests suite.
# Default values should be declared via empty string, to allow them
# to be omitted when extending the matrix.
# The matrix is designed to not expand into any job.
# It is used to document the test environement variations.
# The actual job enviroment are defined in the `include` section.
matrix:
# Run on latest minor release of each major Python version.
python-version: ['3.8', '3.9', '3.10']
# The Python version on which the job is executed..
python-version: ['']
# Just use the default OS.
runs-on: ['']
# Human readable short description for this job.
Expand All @@ -78,6 +83,37 @@ jobs:
# Here the matrix is extended with variations of the default
# value.
include:

# `nodeps` is created to make sure we don't have import errors in the
# runtime and production code.
# The minimum supported Python version should be used to maximize
# coverage of code that otherwise depends on backports.
# Distributed test run is disabled here so that we also have
# end to end functional test usage for non-distributed trial runs.
# When updating the minimum Python version here, also update the
# `python_requires` from `setup.cfg`.
- python-version: '3.7.1'
tox-env: nodeps-withcov-posix
job-name: 'nodeps-test'

# `noipv6` is created to make sure all is OK on an OS which doesn't
# have IPv6 available.
# Any supported Python version is OK for this job.
# We go with latest micro release for the smalles minor relase
# that we support.
- python-version: '3.7'
noipv6: -noipv6
job-name: 'default-tests-noipv6'

# Just Python 3.8 with default settings.
- python-version: '3.8'

# Just Python 3.9 with default settings.
- python-version: '3.9'

# Just Python 3.10 with default settings.
- python-version: '3.10'

# Windows, minimum Python version with select reactor.
- python-version: '3.7'
runs-on: 'windows-2022'
Expand All @@ -87,30 +123,15 @@ jobs:
# the default trial-args to remove concurrent runs and to
# select a reactor.
trial-args: '--reactor=select'
# Windows, latest Python version with iocp reactor.

# Windows, newest Python supported version with iocp reactor.
- python-version: '3.10'
runs-on: 'windows-2022'
tox-env: 'alldeps-withcov-windows'
job-name: 'win-default-tests-iocp'
# Distributed trial is not yet suported on Windows.
trial-args: '--reactor=iocp'
# `noipv6` is created to make sure all is OK on an OS which doesn't
# have IPv6 available.
# Any supported Python version is OK for this job.
- python-version: '3.7'
noipv6: -noipv6
job-name: 'default-tests-noipv6'
# `nodeps` is created to make sure we don't have import errors in the
# runtime and production code.
# The minimum supported Python version should be used to maximize
# coverage of code that otherwise depends on backports.
# Distributed test run is disabled here so that we also have
# end to end functional test usage for non-distributed trial runs.
# When updating the minimum Python version here, also update the
# `python_requires` from `setup.cfg`.
- python-version: '3.7.1'
tox-env: nodeps-withcov-posix
job-name: 'nodeps-test'

# On PYPY coverage is very slow (5min vs 30min) as there is no C
# extension.
# There is very little PYPY specific code so there is not much to
Expand All @@ -119,11 +140,13 @@ jobs:
tox-env: alldeps-nocov-posix
job-name: 'pypy-no-coverage'
skip-coverage: yes

# We still run some tests with coverage,
# as there are test with specific code branches for pypy.
- python-version: pypy-3.7
trial-target: twisted.test.test_compat twisted.test.test_defer twisted.internet.test.test_socket twisted.trial.test.test_tests
job-name: 'pypy-coverage'

# We run selected test for GTK reactor inside X virtual framebuffer.
- python-version: '3.7'
tox-env: alldeps-gtk-withcov-posix
Expand Down Expand Up @@ -212,7 +235,7 @@ jobs:
if: ${{ !cancelled() && !matrix['skip-coverage'] }}
with:
files: coverage.xml
name: ${{ matrix.python-version }}-${{matrix.job-name || 'lnx-default-tests' }}
name: ${{ matrix.python-version || env.DEFAULT_PYTHON_VERSION }}-${{matrix.job-name || 'lnx-default-tests' }}
fail_ci_if_error: true


Expand All @@ -231,7 +254,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
python-version: '${{ env.DEFAULT_PYTHON_VERSION }}'

- name: Install dependencies
run: |
Expand Down Expand Up @@ -277,7 +300,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '${{ env.DEFAULT_PYTHON_VERSION }}'
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
Expand All @@ -294,7 +317,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '{{ env.DEFAULT_PYTHON_VERSION }}'
- name: Install dependencies
run: |
python -m pip install --upgrade pip tox
Expand All @@ -318,7 +341,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '${{ env.DEFAULT_PYTHON_VERSION }}'

- name: Test
run: |
Expand Down

0 comments on commit 07a8125

Please sign in to comment.