Skip to content

Commit d8d9dc8

Browse files
authored
refactor: deprecate junit-upload in favor of junit-process (#715)
1 parent 80ad634 commit d8d9dc8

File tree

2 files changed

+63
-2
lines changed

2 files changed

+63
-2
lines changed

mergify_cli/ci/cli.py

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
)
1818

1919

20-
@ci.command(help="Upload JUnit XML reports")
20+
@ci.command(help="Upload JUnit XML reports", deprecated="Use `junit-process` instead")
2121
@click.option(
2222
"--api-url",
2323
"-u",
@@ -75,6 +75,67 @@ async def junit_upload( # noqa: PLR0913
7575
)
7676

7777

78+
@ci.command(
79+
help="""Upload JUnit XML reports and ignore failed tests with Mergify's CI Insights Quarantine""",
80+
short_help="""Upload JUnit XML reports and ignore failed tests with Mergify's CI Insights Quarantine""",
81+
)
82+
@click.option(
83+
"--api-url",
84+
"-u",
85+
help="URL of the Mergify API",
86+
required=True,
87+
envvar="MERGIFY_API_URL",
88+
default="https://api.mergify.com",
89+
show_default=True,
90+
)
91+
@click.option(
92+
"--token",
93+
"-t",
94+
help="CI Issues Application Key",
95+
required=True,
96+
envvar="MERGIFY_TOKEN",
97+
)
98+
@click.option(
99+
"--repository",
100+
"-r",
101+
help="Repository full name (owner/repo)",
102+
required=True,
103+
default=detector.get_github_repository,
104+
)
105+
@click.option(
106+
"--test-framework",
107+
help="Test framework",
108+
)
109+
@click.option(
110+
"--test-language",
111+
help="Test language",
112+
)
113+
@click.argument(
114+
"files",
115+
nargs=-1,
116+
required=True,
117+
type=click.Path(exists=True, dir_okay=False),
118+
)
119+
@utils.run_with_asyncio
120+
async def junit_process( # noqa: PLR0913
121+
*,
122+
api_url: str,
123+
token: str,
124+
repository: str,
125+
test_framework: str | None,
126+
test_language: str | None,
127+
files: tuple[str, ...],
128+
) -> None:
129+
await _process_junit_files(
130+
api_url=api_url,
131+
token=token,
132+
repository=repository,
133+
test_framework=test_framework,
134+
test_language=test_language,
135+
files=files,
136+
)
137+
138+
78139
async def _process_junit_files( # noqa: PLR0913
79140
*,
80141
api_url: str,

mergify_cli/tests/ci/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_upload_error(monkeypatch: pytest.MonkeyPatch) -> None:
9393
):
9494
mocked_upload.side_effect = Exception("Upload failed")
9595
result = runner.invoke(
96-
cli_junit_upload.junit_upload,
96+
cli_junit_upload.junit_process,
9797
[str(REPORT_XML)],
9898
)
9999
assert result.exit_code == 0, (result.stdout, result.stderr)

0 commit comments

Comments
 (0)