Skip to content

ci: add concurrency cancellation to PR-triggered test workflows#2392

Open
bigbitbus wants to merge 2 commits into
mainfrom
ci/add-concurrency-cancellation
Open

ci: add concurrency cancellation to PR-triggered test workflows#2392
bigbitbus wants to merge 2 commits into
mainfrom
ci/add-concurrency-cancellation

Conversation

@bigbitbus
Copy link
Copy Markdown
Contributor

Why

CI minutes (Depot-hosted GitHub Actions runners, depot-ubuntu-*) have grown ~3–4× since Nov 2025. A primary structural cause: of all workflows, only codeflash.yml had a concurrency block. Every test workflow lacked cancel-in-progress, so pushing several commits to an open PR left all prior in-flight runs running and billed — we paid for one full matrix pass per intermediate commit instead of one per settled state.

What

Adds an identical workflow-level block to the 10 PR-triggered test workflows:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}
  • On PRs — a new push cancels the superseded run for that PR. You only pay for the latest commit's CI (the only result that gates merge).
  • On push: [main] — the expression resolves to false, so runs queue instead of cancelling. Every merged commit keeps its own CI / required checks; nothing is orphaned.
  • Group key is workflow + ref, so distinct PRs never cancel each other and different workflows on the same branch stay independent.

Files

unit_tests_inference_x86, unit_tests_workflows_x86, unit_tests_inference_sdk_x86, unit_tests_inference_cli_x86, unit_tests_inference_experimental, integration_tests_workflows_x86, integration_tests_inference_experimental_cpu, integration_e2e_tests_inference_sdk_x86, check_model_licenses, static_code_analysis.

codeflash already had a concurrency block and is unchanged.

Verification

  • All 10 files parse as valid YAML.
  • No duplicate workflow name: values exist, so no two workflows collide into one cancel-group.
  • Purely additive — no job logic, runner class, or matrix touched. Cancelled runs report cancelled (not failed), so branch protection is unaffected.

Follow-ups (not in this PR)

  • Add paths: filters so Python tests skip docs-only / unrelated-package changes.
  • Right-size large Depot runners (integration_tests_workflows_x86 on -16, docs on -32).
  • Gate docker.inference-exp full 6-image CUDA matrix builds on every push to main.

🤖 Generated with Claude Code

Cancels superseded in-flight runs on a PR when a new commit is pushed,
so CI is billed for ~1 matrix pass per settled state instead of one per
intermediate commit. Cancellation is scoped to pull_request events only
(cancel-in-progress resolves to false on push:[main]) so merged commits
keep their per-commit CI / required checks and nothing is orphaned.

Group key is workflow+ref, so distinct PRs never cancel each other and
different workflows on the same branch stay independent. Verified no
duplicate workflow name: values that would collide group keys.

Applied to the 10 PR-triggered test workflows; codeflash already had a
concurrency block and is left as-is.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants