Merge branch 'release_23.0' into dev

This commit is contained in:
mvdbeek
2023-06-06 15:55:12 +02:00
4 changed files with 46 additions and 8 deletions
+1 -1
View File
@@ -2450,7 +2450,7 @@ class WriteCrates:
"encodingFormat": encoding_format,
}
ro_crate.add_file(
file_name,
os.path.join(self.export_directory, file_name),
dest_path=file_name,
properties=properties,
)
+12 -2
View File
@@ -6,6 +6,8 @@ from typing import (
Optional,
)
from packaging.version import parse
from rocrate import __version__ as rocrate_version
from rocrate.model.computationalworkflow import (
ComputationalWorkflow,
WorkflowDescription,
@@ -102,13 +104,21 @@ class WorkflowRunCrateProfileBuilder:
if dataset.dataset.id in self.model_store.dataset_id_to_path:
filename, _ = self.model_store.dataset_id_to_path[dataset.dataset.id]
if not filename:
# dataset was not serialized
filename = f"datasets/dataset_{dataset.dataset.uuid}"
if parse(rocrate_version) >= parse("0.8.0"):
source = None
else:
# Drop in 23.1
source = filename
else:
source = os.path.join(self.model_store.export_directory, filename)
name = dataset.name
encoding_format = dataset.datatype.get_mime()
properties["name"] = name
properties["encodingFormat"] = encoding_format
file_entity = crate.add_file(
filename,
source,
dest_path=filename,
properties=properties,
)
@@ -272,7 +282,7 @@ class WorkflowRunCrateProfileBuilder:
"encodingFormat": "application/json",
}
crate.add_file(
attrs,
attrs_path,
dest_path=attrs,
properties=properties,
)
+33 -4
View File
@@ -141,8 +141,17 @@ def read_package(package_path: pathlib.Path) -> Package:
return package
def _get_docutils_parser_settings():
try:
return frontend.get_default_settings(Parser)
except AttributeError:
# docutils < 0.18. Remove fallback in 23.1
components = (Parser,)
return frontend.OptionParser(components=components).get_default_values()
def parse_changelog(package: Package) -> List[ChangelogItem]:
settings = frontend.get_default_settings(Parser)
settings = _get_docutils_parser_settings()
document = utils.new_document(str(package.history_rst), settings)
Parser().parse(package.history_rst.read_text(), document)
changelog_items: List[ChangelogItem] = []
@@ -440,6 +449,23 @@ def is_merge_required(base_branch: str, new_branch: str, galaxy_root: pathlib.Pa
return True
def ensure_branches_up_to_date(branches: List[str], base_branch: str, upstream: str, galaxy_root: pathlib.Path):
for branch in branches:
subprocess.run(["git", "checkout", branch], cwd=galaxy_root).check_returncode()
# Check that the head commit matches the commit for the same branch at the specified remote repo url
result = subprocess.run(["git", "ls-remote", upstream, f"refs/heads/{branch}"], capture_output=True, text=True)
result.check_returncode()
remote_commit_hash = result.stdout.split("\t")[0]
result = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True, text=True)
result.check_returncode()
local_commit_hash = result.stdout.strip()
if remote_commit_hash != local_commit_hash:
raise Exception(
f"Local tip of branch {branch} is {local_commit_hash}, remote tip of branch is {remote_commit_hash}. Make sure that your local branches are up to date and track f{upstream}."
)
subprocess.run(["git", "checkout", base_branch], cwd=galaxy_root).check_returncode()
def push_references(references: List[str], upstream: str = "https://github.com/galaxyproject/galaxy.git"):
for reference in references:
subprocess.run(["git", "push", upstream, reference]).check_returncode()
@@ -525,8 +551,11 @@ def create_point_release(
click.confirm("Does this look correct?", abort=True)
base_branch = current_branch = get_current_branch(galaxy_root)
newer_branches = get_branches(galaxy_root, new_version, base_branch)
all_branches = newer_branches + [base_branch]
click.echo("Making sure that all branches are up to date")
ensure_branches_up_to_date(all_branches, base_branch, upstream, galaxy_root)
click.echo("Making sure that merging forward will result in clean merges")
merge_required = False
for new_branch in newer_branches:
merge_required = is_merge_required(base_branch=current_branch, new_branch=new_branch, galaxy_root=galaxy_root)
if merge_required:
@@ -537,7 +566,7 @@ def create_point_release(
if click.confirm("Continue anyway ?", abort=True):
current_branch = new_branch
break
subprocess.run(["git", "checkout", base_branch], cwd=galaxy_root)
subprocess.run(["git", "checkout", base_branch], cwd=galaxy_root).check_returncode()
modified_paths = [set_root_version(galaxy_root, new_version)]
# read packages and find prs that affect a package
packages: List[Package] = []
@@ -600,7 +629,7 @@ def create_point_release(
click.echo(f"Merging {base_branch} into {new_branch}")
merge_and_resolve_branches(galaxy_root, current_branch, new_branch, packages)
current_branch = new_branch
references = [release_tag, base_branch] + newer_branches
references = [release_tag] + all_branches
if no_confirm or click.confirm(f"Push {','.join(references)} to upstream '{upstream}' ?", abort=True):
push_references(references=references, upstream=upstream)
-1
View File
@@ -347,7 +347,6 @@ def validate_has_pl_galaxy(ro_crate: ROCrate):
assert programming_language.id == "https://w3id.org/workflowhub/workflow-ro-crate#galaxy"
assert programming_language.name == "Galaxy"
assert programming_language.url == "https://galaxyproject.org/"
assert programming_language.version
def validate_organize_action(ro_crate: ROCrate):