Skip to content

[feat] Git sparse checkout for sourcesdir#3629

Open
victorusu wants to merge 6 commits intoreframe-hpc:developfrom
victorusu:sparse_checkout
Open

[feat] Git sparse checkout for sourcesdir#3629
victorusu wants to merge 6 commits intoreframe-hpc:developfrom
victorusu:sparse_checkout

Conversation

@victorusu
Copy link
Copy Markdown
Contributor

@victorusu victorusu commented Feb 23, 2026

This expands the sourcesdir syntax to include a dictionary format. In this case, the git url is passed via the url key.
Additional command options can be added via the opts key. This capability was previously available in the git_clone function, but not accessible to the sourcesdir git clone interface.

The git sparse-checkout path is available when one defines the files keys with a list of files to checkout.
In this case, instead of emitting a git clone ... command the framework will emit the following set of commands

git clone --no-checkout --depth=1 ...
git sparse-checkout set --no-cone ${file list}
git checkout

where, ${file list} is the list of files defined in the files list.

An example test is this.

@rfm.simple_test
class git_clone_test(rfm.CompileOnlyRegressionTest):
    sourcesdir = {
         'url': 'https://github.com/eth-cscs/alps-gh200-reproducers.git',
         'files' : ['intranode-pinned-host-comm'],
         'opts' : ['--no-optional-locks', '--no-advice', '--no-pager']
    }
    build_system = 'SingleSource'
    sourcepath = 'intranode-pinned-host-comm/intranode_pinned_host_comm.cpp'
    valid_systems = ['*']
    valid_prog_environs = ['*']

Please note that I haven't added any unit tests because the framework does not include any unit tests for the original git_clone function.

closes #3627
closes #3053

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 29.16667% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.74%. Comparing base (85b5f6b) to head (a066282).

Files with missing lines Patch % Lines
reframe/core/pipeline.py 31.25% 11 Missing ⚠️
reframe/utility/osext.py 25.00% 6 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3629      +/-   ##
===========================================
- Coverage    91.70%   90.74%   -0.97%     
===========================================
  Files           62       62              
  Lines        13727    13741      +14     
===========================================
- Hits         12589    12469     -120     
- Misses        1138     1272     +134     

☔ View full report in Codecov by Sentry.
📢 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.

@victorusu victorusu requested review from ekouts and vkarak February 25, 2026 08:14
@vkarak vkarak added this to the ReFrame 4.10 milestone Feb 25, 2026
@vkarak vkarak changed the title Git sparse checkout for sourcesdir [feat] Git sparse checkout for sourcesdir Feb 25, 2026
Comment thread reframe/core/pipeline.py Outdated
Comment thread reframe/core/pipeline.py Outdated
Comment thread reframe/utility/osext.py
@github-project-automation github-project-automation bot moved this from Todo to In Progress in ReFrame Backlog Mar 9, 2026
Copy link
Copy Markdown
Contributor

@vkarak vkarak left a comment

Choose a reason for hiding this comment

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

@victorusu I have updated and rebased your PR. Can you give it a try? I will likely need to add another unit test to increase coverage, but other than that lgtm now.

@vkarak
Copy link
Copy Markdown
Contributor

vkarak commented Apr 20, 2026

Something was messed with the rebase.

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

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

only clone a subdirectory of a git repo Consider using depth of 1 when automatically cloning a git repo

2 participants