Skip to content

ci: speed up slow test workflows#5532

Closed
njzjz wants to merge 1 commit into
deepmodeling:masterfrom
njzjz:ci/speed-up-slow-tests
Closed

ci: speed up slow test workflows#5532
njzjz wants to merge 1 commit into
deepmodeling:masterfrom
njzjz:ci/speed-up-slow-tests

Conversation

@njzjz

@njzjz njzjz commented Jun 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Cache uv installs in the slow Python and C++ test workflows with astral-sh/setup-uv.
  • Skip source/tests/pt_expt in the CUDA Python job; these PyTorch export/compile tests are already covered by the CPU Python workflow and dominate Python test time.
  • Allow test_cc_local.sh to run ctest entries in parallel when CTEST_PARALLEL_LEVEL is set, and enable 3-way ctest parallelism in the C++ workflow.

Motivation

Recent CI timings show the CUDA workflow is dominated by python -m pytest source/tests:

  • Test CUDA merge queue run 27417297979: total CUDA job ~4h15m; Python pytest ~3h02m; C++ step ~47m; LAMMPS/i-PI ~15m.
  • Test Python run 27417297836: source/tests/pt_expt accounts for ~18,299s of 34,345s cumulative recorded Python 3.13 test duration.
  • Test C++ run 27417297837: TF/PT C++ matrix entries take ~47m, while the Paddle-only entries finish in ~7m.

Validation

  • python YAML parse for changed workflows
  • bash -n source/install/test_cc_local.sh
  • git diff --check
  • ruff check .
  • ruff format --check .
  • pre-commit hooks run by git commit passed for changed files

Summary by CodeRabbit

  • Chores
    • Enhanced CI/CD test infrastructure with parallel test execution for faster feedback cycles.
    • Improved dependency installation mechanism with caching support for quicker setup.
    • Refined test configuration in CUDA workflow for optimized test execution.

@dosubot dosubot Bot added the build label Jun 13, 2026
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates GitHub Actions CI workflows and a local test script with three improvements: replacing pip-based uv installation with the official setup-uv action across all Python test workflows, enabling parallel C++ test execution via a configurable environment variable, and filtering out experimental tests from the CUDA test suite.

Changes

CI and Test Execution

Layer / File(s) Summary
uv installation standardization
.github/workflows/test_cc.yml, .github/workflows/test_python.yml
Replaces pip install uv installation with astral-sh/setup-uv@v7 GitHub Action, enabling cache support in both workflows.
C++ test parallelization configuration
.github/workflows/test_cc.yml, source/install/test_cc_local.sh
Introduces CTEST_PARALLEL_LEVEL: 3 environment variable in the workflow and adds --parallel "${CTEST_PARALLEL_LEVEL:-1}" flag to ctest in the local test script for parallel test execution.
CUDA test filtering
.github/workflows/test_cuda.yml
Adds --ignore=source/tests/pt_expt to pytest invocation to exclude experimental tests from the CUDA test suite.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested labels

build

Suggested reviewers

  • wanghan-iapcm
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main objective of the changeset: optimizing slow test workflows through caching and parallelization improvements.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test_cc.yml:
- Line 45: Replace the floating tag for astral-sh/setup-uv with a pinned full
commit SHA in both places; specifically, in .github/workflows/test_cc.yml (lines
45-45) change `uses: astral-sh/setup-uv@v7` to `uses:
astral-sh/setup-uv@<FULL_COMMIT_SHA>` and in .github/workflows/test_python.yml
(lines 30-30) make the identical change using the same <FULL_COMMIT_SHA> value
so both workflows reference the same immutable commit SHA.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0205eee2-f401-4a7d-b514-22b5ab8755d7

📥 Commits

Reviewing files that changed from the base of the PR and between 5d94bd6 and 3b6e28d.

📒 Files selected for processing (4)
  • .github/workflows/test_cc.yml
  • .github/workflows/test_cuda.yml
  • .github/workflows/test_python.yml
  • source/install/test_cc_local.sh

- uses: lukka/get-cmake@latest
- run: python -m pip install uv
- name: Install uv
uses: astral-sh/setup-uv@v7

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate all workflows that use astral-sh/setup-uv
rg -n --hidden --glob '.github/workflows/*' 'uses:\s*astral-sh/setup-uv@' .github/workflows || true

# Print the surrounding lines for each match (to capture the exact ref)
rg -n --hidden --glob '.github/workflows/*' -U 'uses:\s*astral-sh/setup-uv@' .github/workflows \
  | sed -E 's/^([^:]+):([0-9]+):.*/\1:\2/' \
  | sort -u \
  | while IFS=: read -r file line; do
      echo "---- $file:$line ----"
      # Show ~3 lines around the usage
      nl -ba "$file" | awk -v L="$line" 'NR>=L-3 && NR<=L+3 {print}'
    done

Repository: deepmodeling/deepmd-kit

Length of output: 407


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# List all usages of the setup-uv action across workflows
rg -n --hidden --glob '.github/workflows/*' 'uses:\s*astral-sh/setup-uv@' .github/workflows

echo
echo "=== References (unique) ==="
rg --hidden --glob '.github/workflows/*' 'uses:\s*astral-sh/setup-uv@' .github/workflows \
  | sed -E 's/^.*uses:\s*//' \
  | sort -u

Repository: deepmodeling/deepmd-kit

Length of output: 341


Pin astral-sh/setup-uv to an immutable commit SHA (avoid @v7)
Unpinned uses: references create a shared supply-chain risk across workflows.

  • .github/workflows/test_cc.yml#L45: uses: astral-sh/setup-uv@v7
  • .github/workflows/test_python.yml#L30: uses: astral-sh/setup-uv@v7
  • .github/workflows/copilot-setup-steps.yml#L41: uses: astral-sh/setup-uv@v7

Pin astral-sh/setup-uv to a full commit SHA (and use the same SHA across all workflows).

🧰 Tools
🪛 zizmor (1.25.2)

[error] 45-45: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

📍 Affects 2 files
  • .github/workflows/test_cc.yml#L45-L45 (this comment)
  • .github/workflows/test_python.yml#L30-L30
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/test_cc.yml at line 45, Replace the floating tag for
astral-sh/setup-uv with a pinned full commit SHA in both places; specifically,
in .github/workflows/test_cc.yml (lines 45-45) change `uses:
astral-sh/setup-uv@v7` to `uses: astral-sh/setup-uv@<FULL_COMMIT_SHA>` and in
.github/workflows/test_python.yml (lines 30-30) make the identical change using
the same <FULL_COMMIT_SHA> value so both workflows reference the same immutable
commit SHA.

Source: Linters/SAST tools

@njzjz njzjz added the Test CUDA Trigger test CUDA workflow label Jun 13, 2026
@github-actions github-actions Bot removed the Test CUDA Trigger test CUDA workflow label Jun 13, 2026
@codecov

codecov Bot commented Jun 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.19%. Comparing base (5d94bd6) to head (3b6e28d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5532      +/-   ##
==========================================
- Coverage   82.19%   82.19%   -0.01%     
==========================================
  Files         891      891              
  Lines      101599   101599              
  Branches     4242     4242              
==========================================
- Hits        83507    83506       -1     
  Misses      16789    16789              
- Partials     1303     1304       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@njzjz njzjz closed this Jun 14, 2026
@njzjz

njzjz commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

This PR is drafted by codex and I think it's meaningless.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant