Skip to content

[IsaacLab CI] Run only necessary tests as pre-merge, run full test as post merge#6296

Draft
mataylor-nvidia wants to merge 6 commits into
isaac-sim:developfrom
mataylor-nvidia:mataylor/ci-affected-tests
Draft

[IsaacLab CI] Run only necessary tests as pre-merge, run full test as post merge#6296
mataylor-nvidia wants to merge 6 commits into
isaac-sim:developfrom
mataylor-nvidia:mataylor/ci-affected-tests

Conversation

@mataylor-nvidia

@mataylor-nvidia mataylor-nvidia commented Jun 29, 2026

Copy link
Copy Markdown

Description

This PR reduces pre-merge CI time by using pytest-testmon coverage data to select tests affected by Python source changes.

Read about how testmon works: https://www.testmon.org/

Pre-merge CI now:

  • Runs affected tests selected from the cached Testmon dependency database.
  • Runs installation smoke tests regardless of Testmon selection.
  • Runs rendering tests regardless of Testmon selection because simulation behavior can affect them indirectly.
  • Runs the full suite when static configuration, assets, shell scripts, or other non-Python files change.
  • Falls back to the full suite when changed-file detection or Testmon data is unavailable.

Post-merge CI runs the full test suite and refreshes the Testmon dependency database for future pull requests.

The previous manually maintained test-subset configuration and exact node-ID selection plumbing have been removed.

Dependencies:

  • Adds pytest-testmon as a CI-only dependency.
  • No new runtime dependencies.

Fixes # (OMPE-99210)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • 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
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions Bot added isaac-lab Related to Isaac Lab team infrastructure labels Jun 29, 2026
@mataylor-nvidia mataylor-nvidia marked this pull request as draft June 29, 2026 19:50
@greptile-apps

greptile-apps Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces manually maintained test-node-ID TOML files and the test-node-ids-file/test-node-ids-key plumbing with pytest-testmon to automatically select affected tests on pre-merge CI, while post-merge CI runs the full suite and refreshes the testmon database.

  • Pre-merge selection: on PRs where only Python files changed, --testmon-forceselect is used (with a safe fallback to --testmon-noselect when the cache is cold); PRs touching non-Python files fall back to the full suite automatically.
  • Smoke-test safety net: install_ci/conftest.py wraps pytest_collection_modifyitems as a generator hook to re-insert @pytest.mark.smoke items after testmon deselection, guaranteeing minimum coverage.
  • Post-merge rendering tests: the deleted postmerge-rendering.toml curated subset is replaced by testmon-mode: collect which now exercises all parametrized test cases in the include-files set rather than the previous 23 hand-picked cases — post-merge rendering coverage increases but so does runtime.

Confidence Score: 5/5

Safe to merge; testmon integration is internally consistent, the workspace volume-mount correctly persists data between container and host, and the smoke-hook fallback provides a minimum coverage floor for install-ci cold-starts.

The core mechanics (cache restore → select/collect → write-back via volume mount → cache save) are correctly wired. run-tests explicitly checks for a non-empty .testmondata file before enabling --testmon-forceselect and emits a warning on miss. The smoke-marker restoration in install_ci/conftest.py uses the wrapper=True generator pattern correctly. The only open risks are a duplicated filter pattern that can drift across files, and testmon-mode being silently ignored without a data-dir, both of which are non-blocking.

.github/actions/run-package-tests/action.yml — the relevant-files filter pattern is independently maintained here and in install-ci.yml; future additions to either copy will need a matching update to the other.

Important Files Changed

Filename Overview
.github/actions/run-tests/action.yml Replaces test-node-ids-file/test-node-ids-key with testmon-data-dir/testmon-mode; correctly falls back to --testmon-noselect with a warning when data file is absent in select mode; workspace is always volume-mounted so testmon data persists back to the host.
.github/actions/run-package-tests/action.yml Adds Select Testmon Mode and Restore Testmon Data steps; the mode-selection logic's relevant-file grep pattern is a third independent copy of the pattern (distinct from install-ci.yml and build.yaml), creating a maintenance drift risk.
.github/workflows/install-ci.yml Adds premerge output and testmon cache restore for both x86/ARM jobs; the matching_files approach correctly computes relevant non-doc files, though the pattern differs slightly from the one in run-package-tests.
.github/workflows/build.yaml Removes all github.event_name != push guards, making full test matrix run on post-merge; rendering tests switch from curated TOML node-IDs to testmon-mode: collect (all parametrizations in include-files).
.github/actions/install-ci-run/action.yml Always passes --testmon --testmon-forceselect (or noselect) regardless of data-file existence, unlike run-tests which checks file size first; relies on install_ci/conftest.py smoke hook as the only guaranteed-coverage safety net.
source/isaaclab/test/install_ci/conftest.py Converts pytest_collection_modifyitems to a wrapper=True generator so smoke items can be restored after testmon deselection; logic is correct — smoke items are captured post-env-filter but pre-yield, then re-added post-yield only when --testmon-forceselect is active.
tools/conftest.py Cleanly removes the manual TEST_NODE_IDS_FILE/TEST_NODE_IDS_KEY mechanism; run_individual_tests signature simplified accordingly.
tools/run_install_ci.py Adds --testmon-data-dir arg; correctly volume-mounts the directory as /tmp/testmon and sets TESTMON_DATAFILE; chmod 0o777 on the host directory is a pragmatic CI requirement for cross-user Docker writes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    PR[Pull Request / Push event] --> Changes{Changed files\ndetected?}
    Changes -->|No relevant files| Skip[Skip CI]
    Changes -->|Relevant files| PyOnly{All relevant\nfiles .py?}
    PyOnly -->|Yes - premerge=true| RestoreCache[Restore Testmon Cache]
    PyOnly -->|No - static files changed| RestoreCache
    RestoreCache --> DataExists{.testmondata\nexists?}
    DataExists -->|Yes + premerge=true| ForceSelect["--testmon-forceselect\nRun affected tests only"]
    DataExists -->|No + premerge=true| Fallback["::warning:: Missing data\n--testmon-noselect\nRun full suite"]
    DataExists -->|premerge=false| NoSelect["--testmon-noselect\nRun full suite\n(collect mode)"]
    ForceSelect --> SmokeRestore[Smoke tests restored\nvia conftest hook]
    Fallback --> RunAll
    SmokeRestore --> RunAffected[Run affected + smoke tests]
    NoSelect --> RunAll[Run full test suite]
    RunAffected --> SaveCache[Save updated Testmon cache]
    RunAll --> SaveCache
    SaveCache --> Results[Check test results]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    PR[Pull Request / Push event] --> Changes{Changed files\ndetected?}
    Changes -->|No relevant files| Skip[Skip CI]
    Changes -->|Relevant files| PyOnly{All relevant\nfiles .py?}
    PyOnly -->|Yes - premerge=true| RestoreCache[Restore Testmon Cache]
    PyOnly -->|No - static files changed| RestoreCache
    RestoreCache --> DataExists{.testmondata\nexists?}
    DataExists -->|Yes + premerge=true| ForceSelect["--testmon-forceselect\nRun affected tests only"]
    DataExists -->|No + premerge=true| Fallback["::warning:: Missing data\n--testmon-noselect\nRun full suite"]
    DataExists -->|premerge=false| NoSelect["--testmon-noselect\nRun full suite\n(collect mode)"]
    ForceSelect --> SmokeRestore[Smoke tests restored\nvia conftest hook]
    Fallback --> RunAll
    SmokeRestore --> RunAffected[Run affected + smoke tests]
    NoSelect --> RunAll[Run full test suite]
    RunAffected --> SaveCache[Save updated Testmon cache]
    RunAll --> SaveCache
    SaveCache --> Results[Check test results]
Loading

Reviews (2): Last reviewed commit: "fix" | Re-trigger Greptile

Comment thread .github/actions/run-package-tests/action.yml
Comment thread .github/workflows/install-ci.yml Outdated
--testmon-data-dir "$TESTMON_DATA_DIR"
--results-dir "${{ github.workspace }}/results"
-- --tb=short -sv)
-- --tb=short -sv --testmon)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we use full expand form of --tb and --sv args?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

sure I will replace this

@mataylor-nvidia mataylor-nvidia Jun 30, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

no long form for --tb traceback

description: 'Comma-separated list of specific test files to include'
default: ''
required: false
test-node-ids-file:

@pbarejko pbarejko Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

As I am not that fluent in this part of the github workflow, why did we remove this? Is this the old system that we used to detect the changes and it's replaced by testmon?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I added this in the previous pull request to only run only specific subset of rendering tests on develop, now I am just reverting it because everything should be run post-merge.

https://github.com/isaac-sim/IsaacLab/pull/6247/changes#diff-a189311bb294f7176778705d1a6d3921171c9192cae1165ac444c4d4da7f14b3R64

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

Labels

infrastructure isaac-lab Related to Isaac Lab team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants