Skip to content

ci: Testmon integration for selective unit testing - #6934

Draft
balasaajay wants to merge 21 commits into
NVIDIA:mainfrom
balasaajay:selective-testing-testmon
Draft

ci: Testmon integration for selective unit testing#6934
balasaajay wants to merge 21 commits into
NVIDIA:mainfrom
balasaajay:selective-testing-testmon

Conversation

@balasaajay

@balasaajay balasaajay commented Aug 27, 2026

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do?

Based off of #6772

  • Added support for Testmon in the CI/CD pipeline to enable selective unit-test execution based on PR labels.
  • Updated pyproject.toml and uv.lock to include pytest-testmon as a dependency.
  • Modified GitHub Actions workflow to check for the Run selective unit tests label and determine eligibility for Testmon.
  • Enhanced scripts to handle Testmon modes and cache management.
  • Updated documentation to reflect new Testmon functionality and usage.

This integration allows for more efficient testing by running only relevant tests on eligible PRs, improving CI performance.

⚠️ For major changes (either in lines of code or in its impact), please make sure to first share a design doc with the team. If you're unsure what's the best way to do so, contact @NVIDIA/mcore-oncall.

Issue tracking

For PRs from open-source community contributors:

  • New features: a linked issue is required. Please open a feature request and reference it here before submitting the PR.
  • Small updates (bug fixes, minor improvements): a linked issue is recommended and will accelerate the PR review process.

Linked issue:

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code Typing guidelines
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!

All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.

Step 1: Mark PR as "Ready for Review"

  1. When your PR is ready, click Ready for Review.
  2. An oncall reviewer is auto-assigned and expert reviewers are notified based on your changes.
    • Some PRs may jump straight to step 2. This is determined by .github/CODEOWNERS.

⚠️ Only mark as ready once merge-conflicts are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

Step 2: Final Review

For PRs that change megatron/core, once all expert reviewers have approved, the Final Review label is applied automatically and final reviewers are assigned.

For PRs outside megatron/core, this step is skipped.

Step 3: Approved

Once all required reviewers have approved, the Approved label is applied automatically.

Merge

Any member of mcore-engineers will be able to merge your PR.

- Added support for Testmon in the CI/CD pipeline to enable selective unit-test execution based on PR labels.
- Updated `pyproject.toml` and `uv.lock` to include `pytest-testmon` as a dependency.
- Modified GitHub Actions workflow to check for the `Run selective unit tests` label and determine eligibility for Testmon.
- Enhanced scripts to handle Testmon modes and cache management.
- Updated documentation to reflect new Testmon functionality and usage.

This integration allows for more efficient testing by running only relevant tests on eligible PRs, improving CI performance.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay
balasaajay requested a review from a team as a code owner August 27, 2026 22:10
@svcnvidia-nemo-ci
svcnvidia-nemo-ci marked this pull request as draft August 27, 2026 22:11
@github-actions

Copy link
Copy Markdown
Contributor

This PR has been automatically converted to draft because all PRs must start as drafts.

When you are ready for review, click Ready for Review to begin the review process. This will:

  1. Add the oncall reviewer (optional reviewer)
  2. Add required review teams based on your changes

See the contribution guide for more details.

@copy-pr-bot

copy-pr-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

- Removed unnecessary inputs and streamlined cache key generation in the GitHub Actions workflow.
- Updated conditions for determining Testmon modes and cache hits, enhancing clarity and efficiency.
- Adjusted documentation to reflect changes in Testmon functionality and usage.
- Improved unit tests to align with the new workflow structure and ensure accurate assertions.

These changes optimize the Testmon integration, ensuring more reliable and efficient unit testing in the CI/CD pipeline.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test 2e2f6cf

- Modified the GitHub Actions workflow to sync only the 'test' group, improving efficiency.
- Added installation of `pytest-testmon` version 2.2.0 in the CI test script to ensure compatibility.

These changes enhance the Testmon integration, streamlining the testing process in the CI/CD pipeline.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test 5b548ad

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test d29f94c

- Introduced a `TESTMON_DEPENDENCY_OVERRIDE` variable to specify dependencies for Testmon.
- Updated pytest arguments to include the dependency override for both test selection and collection phases.

These changes improve the flexibility and reliability of the Testmon integration in unit testing.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test bc61419

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test 9c1eed5

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test 078947e

Restore the previous calculator probe, then temporarily reverse the source signature change from NVIDIA#7186. This returns parameter_group.py to the recorded Testmon baseline while preserving existing keyword callers. Keep dependency, container, workflow, and test files unchanged.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test d71d081

Restore the preceding signature probe, then temporarily reverse both source hunks from NVIDIA#7220. Reinstate context-parallel topology rejection to measure selection against the existing database. Leave tests, dependencies, containers, and CI configuration unchanged.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test bdb06d5

Restore the preceding context-parallel validation probe, then temporarily remove the adapter no_sync override introduced in NVIDIA#7186. This returns the adapter file to the recorded baseline and intentionally tests whether selected hybrid accumulation tests catch the behavioral regression. Restore the override after recording results; keep test, dependency, container, and CI files unchanged.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test 90eb48c

Restore the adapter no_sync override and imports after recording the expected hybrid accumulation failures. All experimental source edits are now removed, returning the production tree to the earlier documentation control while preserving pre-existing PR changes. Verify cache reuse and restored unit-test behavior without changing tests, dependencies, containers, or CI configuration.

Signed-off-by: Ajay Balasa <abalasa@nvidia.com>
@balasaajay

Copy link
Copy Markdown
Contributor Author

/ok to test 8257c83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants