Skip to content

Commit

Permalink
publish.py: push tags only for packages included in pkgtags
Browse files Browse the repository at this point in the history
  • Loading branch information
suvayu committed Oct 4, 2024
1 parent 95e33f6 commit af6f872
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions orchestra/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def publish_tags_whls(CONF: dict, pkgtags: Path):
"""
tags = json.loads(pkgtags.read_text())
for pkg, repo_path in CONF["repos"].items():
if pkg not in tags:
continue
repo = Repo(repo_path)
push_tags(CONF, pkg, repo, tags[remote_name(repo)])
dispatch_workflow(CONF, pkgtags)
16 changes: 15 additions & 1 deletion tests/test_publish.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from io import StringIO
import json
from pathlib import Path
import sys

from git import Remote
import pytest

from orchestra import ErrorCodes
from orchestra.publish import dispatch_workflow, push_tags
from orchestra.publish import dispatch_workflow, publish_tags_whls, push_tags

from .conftest import commit, edit, example_pkgs

Expand Down Expand Up @@ -106,3 +107,16 @@ def test_dispatch_workflow(CONF, cmd, monkeypatch):
*_, token = cmd.split()
# the .strip is required on windows as we call powershell explicitly
assert token.strip("'\"") in out


@pytest.mark.parametrize("dup_repos", ["scm"], indirect=True)
@pytest.mark.parametrize("cmd", ["echo {repo} {workflow}"])
def test_publish_tags_whls(CONF, dup_repos, cmd, monkeypatch):
name, _, src, dst = dup_repos
monkeypatch.setattr("sys.stdin", StringIO("0"))
dst.create_tag("test_tag")
pkgtags = Path(f"{dst.working_dir}/pkgtags.json")
pkgtags.write_text(json.dumps({"scm": "test_tag"}))

# FIXME: is this sufficient?
publish_tags_whls(CONF, pkgtags)

0 comments on commit af6f872

Please sign in to comment.