Skip to content

Update CI to label-driven testing#450

Open
Micky774 wants to merge 7 commits intodevfrom
zain/ci
Open

Update CI to label-driven testing#450
Micky774 wants to merge 7 commits intodevfrom
zain/ci

Conversation

@Micky774
Copy link
Contributor

@Micky774 Micky774 commented Feb 17, 2026

Description

With this PR, testing is mediated by labels such as: ci-level {1, 2, 3}. No tests will be run without at least one label present. At any given time, the highest-level label will take precedence, and only its corresponding level of tests will be run. The workflow triggers on labeling, unlabeling, and pushing commits. When removing a label, the workflow will check to see if there are any labels remaining and if there are, it will dispatch to the highest of them.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Collaborator

@ipanfilo ipanfilo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make approach more generic - ci_level% label specifies CI level to use.

@Micky774 Micky774 changed the title Add label-specific workflow for level 3 testing Update CI to label-driven testing Feb 18, 2026

// Check if the removed level was higher than the current level
const currentLevel = level ? Number(level) : 0;
const removedWasHighest = removedLevel > 0 && removedLevel > currentLevel;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: removedLevel > 0 is redundant

pull_request:
branches:
- 'dev'
- 'release_v1.**_rocm'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: release_v1 can be removed. We hardly support GHA for them now

@@ -0,0 +1,135 @@
name: PR Automatic CI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AMD copyright

const toCancel = runs.data.workflow_runs.filter(run => {
const prMatch = (run.pull_requests || []).some(pr => pr.number === prNumber);
const active = run.status === 'queued' || run.status === 'in_progress';
if (action === 'synchronize') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reopened action does not seem handled in this code

// are queued or in progress, and have a lower CI level
const toCancel = runs.data.workflow_runs.filter(run => {
const prMatch = (run.pull_requests || []).some(pr => pr.number === prNumber);
const active = run.status === 'queued' || run.status === 'in_progress';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can return false here if not prMatch or not active so do not need recheck it later. And, probably if run.id === currentRunId

// If a label was added, cancel runs with a lower level than the added label
if (action === 'labeled') {
const isLowerThanAdded = runLevel > 0 && runLevel < addedLevel;
return prMatch && active && isLowerThanAdded && run.id !== currentRunId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can is LowerThanAdded be if run.id === currentRunId?

.map(label => label.name.toLowerCase());

// Determine if a CI level label was removed and what level it was
const removedLabel = (context.payload.label?.name || '').toLowerCase();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it removedLabel? For labeled event it is addedLabel.
Maybe unlabeled events are not needed at all? If higher lablel is added - CI with new level is triggered. Otherwise the last CI run should still be relevant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a PR has labels ci-level 1 and ci-level 3 but then ci-level 3 is removed, then we still need to run ci-level 1 tests.

# See LICENSE for license information.

name: TransformerEngine CI
name: Test and Build Branch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build and Test?

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
group: ${{ github.event_name == 'workflow_call' && format('{0}-{1}-{2}', github.workflow, github.ref, github.run_id) || format('{0}-{1}', github.workflow, github.ref) }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why modified group is needed for workflow_call ?

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