Skip to content

Commit

Permalink
feat: Allow defining branches in meta.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jvfe committed Aug 10, 2024
1 parent fca6f27 commit 092bf91
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions nf_core/components/components_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ def get_components_to_install(subworkflow_dir: str) -> Tuple[List[Dict[str, Opti
"name": name,
"org_path": org_path,
"git_remote": git_remote,
"branch": component[name].get("branch", "master"),
}
component_list.append(comp_dict)
modules = component_list
Expand Down
3 changes: 2 additions & 1 deletion nf_core/components/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ def install(self, component, silent=False):
if isinstance(component, dict):
if component["git_remote"] is not None:
remote_url = component["git_remote"]
self.modules_repo = ModulesRepo(remote_url, self.branch)
branch = component["branch"]
self.modules_repo = ModulesRepo(remote_url, branch)
else:
self.modules_repo = ModulesRepo(self.current_remote, self.branch)
component = component["name"]
Expand Down
5 changes: 4 additions & 1 deletion tests/subworkflows/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from nf_core.subworkflows.install import SubworkflowInstall

from ..utils import (
CROSS_ORGANIZATION_BRANCH,
CROSS_ORGANIZATION_URL,
GITLAB_BRANCH_TEST_BRANCH,
GITLAB_REPO,
Expand Down Expand Up @@ -82,7 +83,9 @@ def test_subworkflows_install_different_branch_fail(self):

def test_subworkflows_install_across_organizations(self):
"""Test installing a subworkflow with modules from different organizations"""
install_obj = SubworkflowInstall(self.pipeline_dir, remote_url=CROSS_ORGANIZATION_URL)
install_obj = SubworkflowInstall(
self.pipeline_dir, remote_url=CROSS_ORGANIZATION_URL, branch=CROSS_ORGANIZATION_BRANCH
)
# The hic_bwamem2 subworkflow contains modules from different organizations
install_obj.install("get_genome_annotation")
# Verify that the installed_by entry was added correctly
Expand Down
1 change: 1 addition & 0 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
OLD_TRIMGALORE_BRANCH = "mimic-old-trimgalore"
GITLAB_URL = "https://gitlab.com/nf-core/modules-test.git"
CROSS_ORGANIZATION_URL = "https://github.com/jvfe/test-subworkflow-remote.git"
CROSS_ORGANIZATION_BRANCH = "main"
GITLAB_REPO = "nf-core-test"
GITLAB_DEFAULT_BRANCH = "main"
GITLAB_SUBWORKFLOWS_BRANCH = "subworkflows"
Expand Down

0 comments on commit 092bf91

Please sign in to comment.