GitHub Actions timeout parameter

We often set a “pip” timeout of 1 or 2 minutes to ensure the CI is using wheels instead of compiling from source, which can take tens of minutes or fail. A job-level timeout can likewise be set.

In this case, rather than setting a job-level timeout-minutes: 6, which would waste 6 minutes if pip tries to build from source, we know pip for this project takes much less than 1 minute, so we only have to wait one minute if pip goes awry. This becomes important for projects with lots of CI jobs and workflows, you don’t want to have to manually wade through hundreds or thousands of error messages.

jobs:

  linux:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: actions/setup-python@v2
      with:
        python-version: '3.x'

    - run: python -m pip install .[tests]
      timeout-minutes: 1

    - run: pytest
      timeout-minutes: 5

Azure

Azure Pipelines also has per-job timeout parameter in YaML.