Skip to content

Increase CI timeout headroom and report slow tests #3559

Increase CI timeout headroom and report slow tests

Increase CI timeout headroom and report slow tests #3559

Workflow file for this run

# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Tests
on:
push:
branches:
- develop
pull_request:
schedule:
- cron: "17 9 * * 1"
workflow_dispatch:
inputs:
diagnostic_no_cov:
description: "Run pytest without coverage and live log CLI to diagnose teardown hangs"
required: false
default: false
type: boolean
jobs:
test:
if: github.event_name != 'schedule'
runs-on: ${{ matrix.operating-system }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- operating-system: windows-latest
python-version: "3.9"
python-tag: py39
- operating-system: windows-latest
python-version: "3.10"
python-tag: py310
- operating-system: windows-latest
python-version: "3.11"
python-tag: py311
env:
MPLBACKEND: Agg # https://github.com/microsoft/azure-pipelines-tasks/issues/16426
steps:
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: constraints/windows-${{ matrix.python-tag }}.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -c constraints/windows-${{ matrix.python-tag }}.txt -e ".[dev]"
- name: Record resolved environment
run: python -m pip freeze --all
- name: Test with pytest
timeout-minutes: 45
env:
NAVIGATE_RUN_PLUGIN_INTEGRATION: "1"
COVERAGE_FILE: .coverage.${{ matrix.python-tag }}
run: |
if ("${{ github.event_name }}" -eq "workflow_dispatch" -and "${{ github.event.inputs.diagnostic_no_cov }}" -eq "true") {
python3 -m pytest --durations=25 --no-cov -o log_cli=false
} else {
python3 -m pytest --durations=25
if (Test-Path coverage.xml) {
Move-Item -Force coverage.xml "coverage-${{ matrix.python-tag }}.xml"
} else {
Write-Error "coverage.xml was not produced."
}
}
- name: Dump Python processes (Windows)
if: ${{ failure() && runner.os == 'Windows' }}
shell: pwsh
run: |
Write-Host "Tasklist snapshot for python processes:"
tasklist /v /fo table | Select-String -Pattern "python"
Write-Host "Detailed process snapshot for python executables:"
Get-CimInstance Win32_Process |
Where-Object { $_.Name -match '^python(3)?(\.exe)?$' } |
Select-Object ProcessId, ParentProcessId, Name, CommandLine |
Format-List
- name: Codecov
if: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.diagnostic_no_cov == 'true') }}
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage/reports/
env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage-${{ matrix.python-tag }}.xml
flags: unittests-${{ matrix.python-tag }}
name: codecov-${{ matrix.operating-system }}-${{ matrix.python-tag }}
verbose: true
experimental-python:
name: Experimental Python 3.12
if: github.event_name != 'schedule'
continue-on-error: true
runs-on: windows-latest
timeout-minutes: 60
env:
MPLBACKEND: Agg
NAVIGATE_RUN_PLUGIN_INTEGRATION: "1"
COVERAGE_FILE: .coverage.py312
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.12
uses: actions/setup-python@v7
with:
python-version: "3.12"
cache: pip
cache-dependency-path: constraints/windows-py312.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -c constraints/windows-py312.txt -e ".[dev]"
- name: Record resolved environment
run: python -m pip freeze --all
- name: Test with pytest
timeout-minutes: 45
run: python -m pytest --durations=25
- name: Dump Python processes (Windows)
if: ${{ failure() }}
shell: pwsh
run: |
Write-Host "Tasklist snapshot for python processes:"
tasklist /v /fo table | Select-String -Pattern "python"
Write-Host "Detailed process snapshot for python executables:"
Get-CimInstance Win32_Process |
Where-Object { $_.Name -match '^python(3)?(\.exe)?$' } |
Select-Object ProcessId, ParentProcessId, Name, CommandLine |
Format-List
latest-dependencies:
name: Latest dependencies (scheduled advisory)
if: github.event_name == 'schedule'
runs-on: windows-latest
timeout-minutes: 60
env:
MPLBACKEND: Agg
NAVIGATE_RUN_PLUGIN_INTEGRATION: "1"
steps:
- uses: actions/checkout@v7
- name: Set up Python 3.10
uses: actions/setup-python@v7
with:
python-version: "3.10"
cache: pip
cache-dependency-path: pyproject.toml
- name: Install latest dependencies without constraints
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Test with pytest
timeout-minutes: 45
run: python -m pytest --durations=25