From 06ecbf16db283d5e678bec1a4f86dd3d57ce98f9 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Fri, 21 Feb 2025 15:11:26 +0000 Subject: [PATCH] [3.13] GH-103180: Set a timeout for every job in GitHub Actions (GH-130375) (cherry picked from commit d0a1e5c222f9f43b492b28806e2a185a50d64500) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- .github/workflows/add-issue-header.yml | 1 + .github/workflows/build.yml | 88 ++++++++++++----------- .github/workflows/documentation-links.yml | 1 + .github/workflows/jit.yml | 1 + .github/workflows/mypy.yml | 6 +- .github/workflows/reusable-docs.yml | 2 +- .github/workflows/reusable-macos.yml | 4 +- .github/workflows/reusable-tsan.yml | 2 +- .github/workflows/reusable-ubuntu.yml | 4 +- .github/workflows/reusable-wasi.yml | 4 +- .github/workflows/stale.yml | 1 - 11 files changed, 60 insertions(+), 54 deletions(-) diff --git a/.github/workflows/add-issue-header.yml b/.github/workflows/add-issue-header.yml index 570b8779994a0f..3cbc23af578d10 100644 --- a/.github/workflows/add-issue-header.yml +++ b/.github/workflows/add-issue-header.yml @@ -18,6 +18,7 @@ jobs: runs-on: ubuntu-latest permissions: issues: write + timeout-minutes: 5 steps: - uses: actions/github-script@v7 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9a6331a1712776..959ebfe59a9553 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: if: fromJSON(needs.build-context.outputs.run-docs) uses: ./.github/workflows/reusable-docs.yml - check_abi: + check-abi: name: 'Check if the ABI has changed' runs-on: ubuntu-22.04 # 24.04 causes spurious errors needs: build-context @@ -88,7 +88,7 @@ jobs: name: abi-data path: ./Doc/data/*.abi - check_autoconf_regen: + check-autoconf-regen: name: 'Check if Autoconf files are up to date' # Don't use ubuntu-latest but a specific version to make the job # reproducible: to get the same tools versions (autoconf, aclocal, ...) @@ -131,7 +131,7 @@ jobs: exit 1 fi - check_generated_files: + check-generated-files: name: 'Check if generated files are up to date' # Don't use ubuntu-latest but a specific version to make the job # reproducible: to get the same tools versions (autoconf, aclocal, ...) @@ -192,7 +192,7 @@ jobs: if: github.event_name == 'pull_request' # $GITHUB_EVENT_NAME run: make check-c-globals - build_windows: + build-windows: name: >- Windows ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} @@ -224,7 +224,7 @@ jobs: arch: ${{ matrix.arch }} free-threading: ${{ matrix.free-threading }} - build_windows_msi: + build-windows-msi: name: >- # ${{ '' } is a hack to nest jobs under the same sidebar category Windows MSI${{ '' }} needs: build-context @@ -239,7 +239,7 @@ jobs: with: arch: ${{ matrix.arch }} - build_macos: + build-macos: name: >- macOS ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} @@ -273,7 +273,7 @@ jobs: free-threading: ${{ matrix.free-threading }} os: ${{ matrix.os }} - build_ubuntu: + build-ubuntu: name: >- Ubuntu ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} @@ -289,7 +289,7 @@ jobs: config_hash: ${{ needs.build-context.outputs.config-hash }} free-threading: ${{ matrix.free-threading }} - build_ubuntu_ssltests: + build-ubuntu-ssltests: name: 'Ubuntu SSL tests with OpenSSL' runs-on: ${{ matrix.os }} timeout-minutes: 60 @@ -350,7 +350,7 @@ jobs: - name: SSL tests run: ./python Lib/test/ssltests.py - build_wasi: + build-wasi: name: 'WASI' needs: build-context if: needs.build-context.outputs.run-tests == 'true' @@ -358,7 +358,7 @@ jobs: with: config_hash: ${{ needs.build-context.outputs.config-hash }} - test_hypothesis: + test-hypothesis: name: "Hypothesis tests on Ubuntu" runs-on: ubuntu-24.04 timeout-minutes: 60 @@ -472,8 +472,7 @@ jobs: name: hypothesis-example-db path: .hypothesis/examples/ - - build_asan: + build-asan: name: 'Address sanitizer' runs-on: ${{ matrix.os }} timeout-minutes: 60 @@ -536,7 +535,7 @@ jobs: - name: Tests run: xvfb-run make test - build_tsan: + build-tsan: name: >- Thread sanitizer ${{ fromJSON(matrix.free-threading) && '(free-threading)' || '' }} @@ -580,8 +579,8 @@ jobs: output-sarif: true sanitizer: ${{ matrix.sanitizer }} - name: Upload crash - uses: actions/upload-artifact@v4 if: failure() && steps.build.outcome == 'success' + uses: actions/upload-artifact@v4 with: name: ${{ matrix.sanitizer }}-artifacts path: ./out/artifacts @@ -594,35 +593,34 @@ jobs: all-required-green: # This job does nothing and is only used for the branch protection name: All required checks pass - if: always() - + runs-on: ubuntu-latest + timeout-minutes: 5 needs: - build-context # Transitive dependency, needed to access `run-tests` value - check-docs - - check_autoconf_regen - - check_generated_files - - build_macos - - build_ubuntu - - build_ubuntu_ssltests - - build_wasi - - build_windows - - build_windows_msi - - test_hypothesis - - build_asan - - build_tsan + - check-autoconf-regen + - check-generated-files + - build-windows + - build-windows-msi + - build-macos + - build-ubuntu + - build-ubuntu-ssltests + - build-wasi + - test-hypothesis + - build-asan + - build-tsan - cifuzz - - runs-on: ubuntu-latest + if: always() steps: - name: Check whether the needed jobs succeeded or failed uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe with: allowed-failures: >- - build_ubuntu_ssltests, - build_windows_msi, + build-windows-msi, + build-ubuntu-ssltests, + test-hypothesis, cifuzz, - test_hypothesis, allowed-skips: >- ${{ !fromJSON(needs.build-context.outputs.run-docs) @@ -634,16 +632,22 @@ jobs: ${{ needs.build-context.outputs.run-tests != 'true' && ' - check_autoconf_regen, - check_generated_files, - build_macos, - build_ubuntu, - build_ubuntu_ssltests, - build_wasi, - build_windows, - build_asan, - build_tsan, - test_hypothesis, + check-autoconf-regen, + check-generated-files, + build-macos, + build-ubuntu, + build-ubuntu-ssltests, + build-wasi, + test-hypothesis, + build-asan, + build-tsan, + ' + || '' + }} + ${{ + !fromJSON(needs.build-context.outputs.run-windows-tests) + && ' + build-windows, ' || '' }} diff --git a/.github/workflows/documentation-links.yml b/.github/workflows/documentation-links.yml index fdb4b9aa29a7c8..a09a30587b35eb 100644 --- a/.github/workflows/documentation-links.yml +++ b/.github/workflows/documentation-links.yml @@ -19,6 +19,7 @@ jobs: runs-on: ubuntu-latest permissions: pull-requests: write + timeout-minutes: 5 steps: - uses: readthedocs/actions/preview@v1 diff --git a/.github/workflows/jit.yml b/.github/workflows/jit.yml index 508bb8c42bcf59..d08fb9b3e8d6a2 100644 --- a/.github/workflows/jit.yml +++ b/.github/workflows/jit.yml @@ -172,6 +172,7 @@ jobs: name: Free-Threaded (Debug) needs: interpreter runs-on: ubuntu-latest + timeout-minutes: 90 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml index 5dfa8d7bcafd78..6d1c6b5b5e6347 100644 --- a/.github/workflows/mypy.yml +++ b/.github/workflows/mypy.yml @@ -33,6 +33,9 @@ concurrency: jobs: mypy: + name: Run mypy on ${{ matrix.target }} + runs-on: ubuntu-latest + timeout-minutes: 10 strategy: fail-fast: false matrix: @@ -46,9 +49,6 @@ jobs: "Tools/peg_generator", "Tools/wasm", ] - name: Run mypy on ${{ matrix.target }} - runs-on: ubuntu-latest - timeout-minutes: 10 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/reusable-docs.yml b/.github/workflows/reusable-docs.yml index 6738acc98c6565..79c28223ac3706 100644 --- a/.github/workflows/reusable-docs.yml +++ b/.github/workflows/reusable-docs.yml @@ -15,7 +15,7 @@ env: FORCE_COLOR: 1 jobs: - build_doc: + build-doc: name: 'Docs' runs-on: ubuntu-latest timeout-minutes: 60 diff --git a/.github/workflows/reusable-macos.yml b/.github/workflows/reusable-macos.yml index 4998a6379f4d14..82b14ef854988b 100644 --- a/.github/workflows/reusable-macos.yml +++ b/.github/workflows/reusable-macos.yml @@ -19,8 +19,9 @@ env: FORCE_COLOR: 1 jobs: - build_macos: + build-macos: name: build and test (${{ inputs.os }}) + runs-on: ${{ inputs.os }} timeout-minutes: 60 env: HOMEBREW_NO_ANALYTICS: 1 @@ -29,7 +30,6 @@ jobs: HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 PYTHONSTRICTEXTENSIONBUILD: 1 TERM: linux - runs-on: ${{ inputs.os }} steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/reusable-tsan.yml b/.github/workflows/reusable-tsan.yml index 545fe25f0aa27e..1d50c3b2366610 100644 --- a/.github/workflows/reusable-tsan.yml +++ b/.github/workflows/reusable-tsan.yml @@ -16,7 +16,7 @@ env: FORCE_COLOR: 1 jobs: - build_tsan_reusable: + build-tsan-reusable: name: 'Thread sanitizer' runs-on: ubuntu-24.04 timeout-minutes: 60 diff --git a/.github/workflows/reusable-ubuntu.yml b/.github/workflows/reusable-ubuntu.yml index 94309f920a764a..b2625339d19ab6 100644 --- a/.github/workflows/reusable-ubuntu.yml +++ b/.github/workflows/reusable-ubuntu.yml @@ -16,10 +16,10 @@ env: FORCE_COLOR: 1 jobs: - build_ubuntu_reusable: + build-ubuntu-reusable: name: 'build and test' - timeout-minutes: 60 runs-on: ${{ matrix.os }} + timeout-minutes: 60 strategy: fail-fast: false matrix: diff --git a/.github/workflows/reusable-wasi.yml b/.github/workflows/reusable-wasi.yml index 36a0e4ef673260..6beb91e66d4027 100644 --- a/.github/workflows/reusable-wasi.yml +++ b/.github/workflows/reusable-wasi.yml @@ -11,10 +11,10 @@ env: FORCE_COLOR: 1 jobs: - build_wasi_reusable: + build-wasi-reusable: name: 'build and test' - timeout-minutes: 60 runs-on: ubuntu-24.04 + timeout-minutes: 60 env: WASMTIME_VERSION: 22.0.0 WASI_SDK_VERSION: 24 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7578189f5d4d67..febb2dd823a8fe 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -7,7 +7,6 @@ on: jobs: stale: if: github.repository_owner == 'python' - runs-on: ubuntu-latest permissions: pull-requests: write