diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6767cd306f7..f0816af5f7d 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,7 +1,7 @@ # Try to get a short workflow name and a job name that start with Python # version to make it easier to check the status inside GitHub UI. # -# When using external actions check that the extenral repos are permitted via +# When using external actions check that the external repos are permitted via # the GitHub configuration at https://github.com/twisted/twisted/settings/actions # name: CI @@ -14,6 +14,13 @@ on: pull_request: branches: [ trunk ] + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' + required: false + default: false # Only have a run a single parallel for each branch. # Runs for trunk are queues. @@ -30,27 +37,26 @@ defaults: env: # Set to 'yes' to open a tunnel to GitHub's VMs through tmate on failures. + # You can also trigger it via manual workflow trigger. + # https://github.com/mxschmitt/action-tmate#manually-triggered-debug 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 || env.DEFAULT_PYTHON_VERSION }}-${{ matrix.job-name || env.DEFAULT_JOB_NAME }} + # We can't use `env.*` in the job name, only in the steps. + name: ${{ matrix.python-version }}-${{ matrix.job-name || 'default-tests' }} # We have Ubuntu as the base for running agains multiple Python versions. - runs-on: "${{ matrix.runs-on || env.DEFAULT_RUNS_ON }}" + runs-on: "${{ matrix.runs-on || 'ubuntu-20.04' }}" env: # By default we run all tests with all deps with coverage. - TOXENV: "${{ matrix.tox-env || env.DEFAULT_TOX_ENV }}" + TOXENV: "${{ matrix.tox-env || 'alldeps-withcov-posix' }}" # 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 || env.DEFAULT_TRIAL_ARGS }}" + TRIAL_ARGS: "${{ matrix.trial-args || '-j 4' }}" strategy: fail-fast: false # The matrix is designed to not expand into any job. @@ -77,7 +83,7 @@ jobs: tox-wrapper: [''] # Tests are executed with the default target which is the full test suite. trial-target: [''] - # By default the coverate is not skipped. + # By default the coverage is not skipped. skip-coverage: [''] # Here the matrix is extended with variations of the default @@ -138,14 +144,14 @@ jobs: # gain from reporting coverage. - python-version: pypy-3.7 tox-env: alldeps-nocov-posix - job-name: 'pypy-no-coverage' + job-name: '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' + job-name: 'with-coverage' # We run selected test for GTK reactor inside X virtual framebuffer. - python-version: '3.7' @@ -215,8 +221,9 @@ jobs: ${{ matrix.tox-wrapper }} tox ${{ matrix.trial-target }} # If one of the above steps fails, fire up tmate for remote debugging. - - name: Tmate debug on failure - if: ${{ !cancelled() && env.TMATE_DEBUG == 'yes' }} + # This is fired for manual trigger or via the environment variable. + - name: Tmate debug session + if: ${{ !cancelled() && (env.TMATE_DEBUG == 'yes' || github.event_name == 'workflow_dispatch' && inputs.debug_enabled ) }} uses: mxschmitt/action-tmate@v3 with: limit-access-to-actor: true