codecov-cli 10.1.0__cp313-cp313-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codecov_cli/__init__.py +3 -0
- codecov_cli/fallbacks.py +41 -0
- codecov_cli/main.py +97 -0
- codecov_cli/opentelemetry.py +26 -0
- codecov_cli/types.py +88 -0
- codecov_cli-10.1.0.dist-info/LICENSE +201 -0
- codecov_cli-10.1.0.dist-info/METADATA +556 -0
- codecov_cli-10.1.0.dist-info/RECORD +12 -0
- codecov_cli-10.1.0.dist-info/WHEEL +5 -0
- codecov_cli-10.1.0.dist-info/entry_points.txt +3 -0
- codecov_cli-10.1.0.dist-info/top_level.txt +2 -0
- staticcodecov_languages.cp313-win32.pyd +0 -0
codecov_cli/__init__.py
ADDED
codecov_cli/fallbacks.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import typing
|
|
2
|
+
from enum import Enum, auto
|
|
3
|
+
|
|
4
|
+
import click
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class FallbackFieldEnum(Enum):
|
|
8
|
+
branch = auto()
|
|
9
|
+
build_code = auto()
|
|
10
|
+
build_url = auto()
|
|
11
|
+
commit_sha = auto()
|
|
12
|
+
git_service = auto()
|
|
13
|
+
job_code = auto()
|
|
14
|
+
pull_request_number = auto()
|
|
15
|
+
service = auto()
|
|
16
|
+
slug = auto()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class CodecovOption(click.Option):
|
|
20
|
+
def __init__(self, *args, **kwargs):
|
|
21
|
+
self.fallback_field = kwargs.pop("fallback_field", None)
|
|
22
|
+
super().__init__(*args, **kwargs)
|
|
23
|
+
|
|
24
|
+
def get_default(
|
|
25
|
+
self, ctx: click.Context, call: bool = True
|
|
26
|
+
) -> typing.Optional[typing.Union[typing.Any, typing.Callable[[], typing.Any]]]:
|
|
27
|
+
res = super().get_default(ctx, call=call)
|
|
28
|
+
if res is not None:
|
|
29
|
+
return res
|
|
30
|
+
if self.fallback_field is not None:
|
|
31
|
+
if ctx.obj.get("ci_adapter") is not None:
|
|
32
|
+
res = ctx.obj.get("ci_adapter").get_fallback_value(self.fallback_field)
|
|
33
|
+
if res is not None:
|
|
34
|
+
return res
|
|
35
|
+
if ctx.obj.get("versioning_system") is not None:
|
|
36
|
+
res = ctx.obj.get("versioning_system").get_fallback_value(
|
|
37
|
+
self.fallback_field
|
|
38
|
+
)
|
|
39
|
+
if res is not None:
|
|
40
|
+
return res
|
|
41
|
+
return None
|
codecov_cli/main.py
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import pathlib
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from codecov_cli import __version__
|
|
8
|
+
from codecov_cli.opentelemetry import init_telem
|
|
9
|
+
from codecov_cli.commands.base_picking import pr_base_picking
|
|
10
|
+
from codecov_cli.commands.commit import create_commit
|
|
11
|
+
from codecov_cli.commands.create_report_result import create_report_results
|
|
12
|
+
from codecov_cli.commands.empty_upload import empty_upload
|
|
13
|
+
from codecov_cli.commands.get_report_results import get_report_results
|
|
14
|
+
from codecov_cli.commands.labelanalysis import label_analysis
|
|
15
|
+
from codecov_cli.commands.process_test_results import process_test_results
|
|
16
|
+
from codecov_cli.commands.report import create_report
|
|
17
|
+
from codecov_cli.commands.send_notifications import send_notifications
|
|
18
|
+
from codecov_cli.commands.staticanalysis import static_analysis
|
|
19
|
+
from codecov_cli.commands.upload import do_upload
|
|
20
|
+
from codecov_cli.commands.upload_coverage import upload_coverage
|
|
21
|
+
from codecov_cli.commands.upload_process import upload_process
|
|
22
|
+
from codecov_cli.helpers.ci_adapters import get_ci_adapter, get_ci_providers_list
|
|
23
|
+
from codecov_cli.helpers.config import load_cli_config
|
|
24
|
+
from codecov_cli.helpers.logging_utils import configure_logger
|
|
25
|
+
from codecov_cli.helpers.versioning_systems import get_versioning_system
|
|
26
|
+
|
|
27
|
+
logger = logging.getLogger("codecovcli")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@click.group()
|
|
31
|
+
@click.option(
|
|
32
|
+
"--auto-load-params-from",
|
|
33
|
+
type=click.Choice(
|
|
34
|
+
[provider.get_service_name() for provider in get_ci_providers_list()],
|
|
35
|
+
case_sensitive=False,
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
@click.option(
|
|
39
|
+
"--codecov-yml-path",
|
|
40
|
+
type=click.Path(path_type=pathlib.Path),
|
|
41
|
+
default=None,
|
|
42
|
+
)
|
|
43
|
+
@click.option(
|
|
44
|
+
"--enterprise-url", "--url", "-u", help="Change the upload host (Enterprise use)"
|
|
45
|
+
)
|
|
46
|
+
@click.option("-v", "--verbose", "verbose", help="Use verbose logging", is_flag=True)
|
|
47
|
+
@click.option(
|
|
48
|
+
"--disable-telem", help="Disable sending telemetry data to Codecov", is_flag=True
|
|
49
|
+
)
|
|
50
|
+
@click.pass_context
|
|
51
|
+
@click.version_option(__version__, prog_name="codecovcli")
|
|
52
|
+
def cli(
|
|
53
|
+
ctx: click.Context,
|
|
54
|
+
auto_load_params_from: typing.Optional[str],
|
|
55
|
+
codecov_yml_path: pathlib.Path,
|
|
56
|
+
enterprise_url: str,
|
|
57
|
+
verbose: bool = False,
|
|
58
|
+
disable_telem: bool = False,
|
|
59
|
+
):
|
|
60
|
+
ctx.obj["cli_args"] = ctx.params
|
|
61
|
+
ctx.obj["cli_args"]["version"] = f"cli-{__version__}"
|
|
62
|
+
configure_logger(logger, log_level=(logging.DEBUG if verbose else logging.INFO))
|
|
63
|
+
ctx.help_option_names = ["-h", "--help"]
|
|
64
|
+
ctx.obj["ci_adapter"] = get_ci_adapter(auto_load_params_from)
|
|
65
|
+
ctx.obj["versioning_system"] = get_versioning_system()
|
|
66
|
+
ctx.obj["codecov_yaml"] = load_cli_config(codecov_yml_path)
|
|
67
|
+
if ctx.obj["codecov_yaml"] is None:
|
|
68
|
+
logger.debug("No codecov_yaml found")
|
|
69
|
+
elif (token := ctx.obj["codecov_yaml"].get("codecov", {}).get("token")) is not None:
|
|
70
|
+
ctx.default_map = {ctx.invoked_subcommand: {"token": token}}
|
|
71
|
+
ctx.obj["enterprise_url"] = enterprise_url
|
|
72
|
+
ctx.obj["disable_telem"] = disable_telem
|
|
73
|
+
|
|
74
|
+
init_telem(ctx.obj)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
cli.add_command(do_upload)
|
|
78
|
+
cli.add_command(create_commit)
|
|
79
|
+
cli.add_command(create_report)
|
|
80
|
+
cli.add_command(create_report_results)
|
|
81
|
+
cli.add_command(get_report_results)
|
|
82
|
+
cli.add_command(pr_base_picking)
|
|
83
|
+
cli.add_command(label_analysis)
|
|
84
|
+
cli.add_command(static_analysis)
|
|
85
|
+
cli.add_command(empty_upload)
|
|
86
|
+
cli.add_command(upload_coverage)
|
|
87
|
+
cli.add_command(upload_process)
|
|
88
|
+
cli.add_command(send_notifications)
|
|
89
|
+
cli.add_command(process_test_results)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def run():
|
|
93
|
+
cli(obj={})
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
run()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
import sentry_sdk
|
|
5
|
+
|
|
6
|
+
from codecov_cli import __version__
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def init_telem(ctx):
|
|
10
|
+
if ctx["disable_telem"]:
|
|
11
|
+
return
|
|
12
|
+
if ctx["enterprise_url"]: # dont run on dedicated cloud
|
|
13
|
+
return
|
|
14
|
+
if os.getenv("CODECOV_ENV", "production") == "test":
|
|
15
|
+
return
|
|
16
|
+
|
|
17
|
+
sentry_sdk.init(
|
|
18
|
+
dsn="https://0bea75c61745c221a6ef1ac1709b1f4d@o26192.ingest.us.sentry.io/4508615876083713",
|
|
19
|
+
enable_tracing=True,
|
|
20
|
+
environment=os.getenv("CODECOV_ENV", "production"),
|
|
21
|
+
release=f"cli@{__version__}",
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def close_telem():
|
|
26
|
+
sentry_sdk.flush()
|
codecov_cli/types.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import pathlib
|
|
2
|
+
import typing as t
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
|
|
7
|
+
from codecov_cli.helpers.ci_adapters.base import CIAdapterBase
|
|
8
|
+
from codecov_cli.helpers.versioning_systems import VersioningSystemInterface
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ContextObject(t.TypedDict):
|
|
12
|
+
ci_adapter: t.Optional[CIAdapterBase]
|
|
13
|
+
versioning_system: t.Optional[VersioningSystemInterface]
|
|
14
|
+
codecov_yaml: t.Optional[dict]
|
|
15
|
+
enterprise_url: t.Optional[str]
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CommandContext(click.Context):
|
|
19
|
+
obj: ContextObject
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class UploadCollectionResultFile(object):
|
|
23
|
+
def __init__(self, path: pathlib.Path):
|
|
24
|
+
self.path = path
|
|
25
|
+
|
|
26
|
+
def get_filename(self) -> bytes:
|
|
27
|
+
return bytes(self.path)
|
|
28
|
+
|
|
29
|
+
def get_content(self) -> bytes:
|
|
30
|
+
with open(self.path, "rb") as f:
|
|
31
|
+
return f.read()
|
|
32
|
+
|
|
33
|
+
def __repr__(self) -> str:
|
|
34
|
+
return str(self.path)
|
|
35
|
+
|
|
36
|
+
def __eq__(self, other):
|
|
37
|
+
if not isinstance(other, UploadCollectionResultFile):
|
|
38
|
+
return False
|
|
39
|
+
|
|
40
|
+
return self.path == other.path
|
|
41
|
+
|
|
42
|
+
def __hash__(self) -> int:
|
|
43
|
+
return hash(str(self.path))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass
|
|
47
|
+
class UploadCollectionResultFileFixer(object):
|
|
48
|
+
__slots__ = ["path", "fixed_lines_without_reason", "fixed_lines_with_reason", "eof"]
|
|
49
|
+
path: pathlib.Path
|
|
50
|
+
fixed_lines_without_reason: t.Set[int]
|
|
51
|
+
fixed_lines_with_reason: t.Optional[t.Set[t.Tuple[int, str]]]
|
|
52
|
+
eof: t.Optional[int]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class UploadCollectionResult(object):
|
|
57
|
+
__slots__ = ["network", "files", "file_fixes"]
|
|
58
|
+
network: t.List[str]
|
|
59
|
+
files: t.List[UploadCollectionResultFile]
|
|
60
|
+
file_fixes: t.List[UploadCollectionResultFileFixer]
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class PreparationPluginInterface(object):
|
|
64
|
+
def run_preparation(self) -> None:
|
|
65
|
+
pass
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
@dataclass
|
|
69
|
+
class RequestResultWarning(object):
|
|
70
|
+
__slots__ = ("message",)
|
|
71
|
+
message: str
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass
|
|
75
|
+
class RequestError(object):
|
|
76
|
+
__slots__ = ("code", "params", "description")
|
|
77
|
+
code: str
|
|
78
|
+
params: t.Dict
|
|
79
|
+
description: str
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass
|
|
83
|
+
class RequestResult(object):
|
|
84
|
+
__slots__ = ("error", "warnings", "status_code", "text")
|
|
85
|
+
error: t.Optional[RequestError]
|
|
86
|
+
warnings: t.List[RequestResultWarning]
|
|
87
|
+
status_code: int
|
|
88
|
+
text: str
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,556 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: codecov-cli
|
|
3
|
+
Version: 10.1.0
|
|
4
|
+
Summary: Codecov Command Line Interface
|
|
5
|
+
Author-email: Tom Hu <thomas.hu@sentry.io>
|
|
6
|
+
Maintainer-email: Codecov Support <support@codecov.io>
|
|
7
|
+
License: Apache License
|
|
8
|
+
Version 2.0, January 2004
|
|
9
|
+
http://www.apache.org/licenses/
|
|
10
|
+
|
|
11
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
12
|
+
|
|
13
|
+
1. Definitions.
|
|
14
|
+
|
|
15
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
16
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
17
|
+
|
|
18
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
19
|
+
the copyright owner that is granting the License.
|
|
20
|
+
|
|
21
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
22
|
+
other entities that control, are controlled by, or are under common
|
|
23
|
+
control with that entity. For the purposes of this definition,
|
|
24
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
25
|
+
direction or management of such entity, whether by contract or
|
|
26
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
27
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
28
|
+
|
|
29
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
30
|
+
exercising permissions granted by this License.
|
|
31
|
+
|
|
32
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
33
|
+
including but not limited to software source code, documentation
|
|
34
|
+
source, and configuration files.
|
|
35
|
+
|
|
36
|
+
"Object" form shall mean any form resulting from mechanical
|
|
37
|
+
transformation or translation of a Source form, including but
|
|
38
|
+
not limited to compiled object code, generated documentation,
|
|
39
|
+
and conversions to other media types.
|
|
40
|
+
|
|
41
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
42
|
+
Object form, made available under the License, as indicated by a
|
|
43
|
+
copyright notice that is included in or attached to the work
|
|
44
|
+
(an example is provided in the Appendix below).
|
|
45
|
+
|
|
46
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
47
|
+
form, that is based on (or derived from) the Work and for which the
|
|
48
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
49
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
50
|
+
of this License, Derivative Works shall not include works that remain
|
|
51
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
52
|
+
the Work and Derivative Works thereof.
|
|
53
|
+
|
|
54
|
+
"Contribution" shall mean any work of authorship, including
|
|
55
|
+
the original version of the Work and any modifications or additions
|
|
56
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
57
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
58
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
59
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
60
|
+
means any form of electronic, verbal, or written communication sent
|
|
61
|
+
to the Licensor or its representatives, including but not limited to
|
|
62
|
+
communication on electronic mailing lists, source code control systems,
|
|
63
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
64
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
65
|
+
excluding communication that is conspicuously marked or otherwise
|
|
66
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
67
|
+
|
|
68
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
69
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
70
|
+
subsequently incorporated within the Work.
|
|
71
|
+
|
|
72
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
73
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
74
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
75
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
76
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
77
|
+
Work and such Derivative Works in Source or Object form.
|
|
78
|
+
|
|
79
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
80
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
81
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
82
|
+
(except as stated in this section) patent license to make, have made,
|
|
83
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
84
|
+
where such license applies only to those patent claims licensable
|
|
85
|
+
by such Contributor that are necessarily infringed by their
|
|
86
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
87
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
88
|
+
institute patent litigation against any entity (including a
|
|
89
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
90
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
91
|
+
or contributory patent infringement, then any patent licenses
|
|
92
|
+
granted to You under this License for that Work shall terminate
|
|
93
|
+
as of the date such litigation is filed.
|
|
94
|
+
|
|
95
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
96
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
97
|
+
modifications, and in Source or Object form, provided that You
|
|
98
|
+
meet the following conditions:
|
|
99
|
+
|
|
100
|
+
(a) You must give any other recipients of the Work or
|
|
101
|
+
Derivative Works a copy of this License; and
|
|
102
|
+
|
|
103
|
+
(b) You must cause any modified files to carry prominent notices
|
|
104
|
+
stating that You changed the files; and
|
|
105
|
+
|
|
106
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
107
|
+
that You distribute, all copyright, patent, trademark, and
|
|
108
|
+
attribution notices from the Source form of the Work,
|
|
109
|
+
excluding those notices that do not pertain to any part of
|
|
110
|
+
the Derivative Works; and
|
|
111
|
+
|
|
112
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
113
|
+
distribution, then any Derivative Works that You distribute must
|
|
114
|
+
include a readable copy of the attribution notices contained
|
|
115
|
+
within such NOTICE file, excluding those notices that do not
|
|
116
|
+
pertain to any part of the Derivative Works, in at least one
|
|
117
|
+
of the following places: within a NOTICE text file distributed
|
|
118
|
+
as part of the Derivative Works; within the Source form or
|
|
119
|
+
documentation, if provided along with the Derivative Works; or,
|
|
120
|
+
within a display generated by the Derivative Works, if and
|
|
121
|
+
wherever such third-party notices normally appear. The contents
|
|
122
|
+
of the NOTICE file are for informational purposes only and
|
|
123
|
+
do not modify the License. You may add Your own attribution
|
|
124
|
+
notices within Derivative Works that You distribute, alongside
|
|
125
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
126
|
+
that such additional attribution notices cannot be construed
|
|
127
|
+
as modifying the License.
|
|
128
|
+
|
|
129
|
+
You may add Your own copyright statement to Your modifications and
|
|
130
|
+
may provide additional or different license terms and conditions
|
|
131
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
132
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
133
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
134
|
+
the conditions stated in this License.
|
|
135
|
+
|
|
136
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
137
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
138
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
139
|
+
this License, without any additional terms or conditions.
|
|
140
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
141
|
+
the terms of any separate license agreement you may have executed
|
|
142
|
+
with Licensor regarding such Contributions.
|
|
143
|
+
|
|
144
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
145
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
146
|
+
except as required for reasonable and customary use in describing the
|
|
147
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
148
|
+
|
|
149
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
150
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
151
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
152
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
153
|
+
implied, including, without limitation, any warranties or conditions
|
|
154
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
155
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
156
|
+
appropriateness of using or redistributing the Work and assume any
|
|
157
|
+
risks associated with Your exercise of permissions under this License.
|
|
158
|
+
|
|
159
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
160
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
161
|
+
unless required by applicable law (such as deliberate and grossly
|
|
162
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
163
|
+
liable to You for damages, including any direct, indirect, special,
|
|
164
|
+
incidental, or consequential damages of any character arising as a
|
|
165
|
+
result of this License or out of the use or inability to use the
|
|
166
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
167
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
168
|
+
other commercial damages or losses), even if such Contributor
|
|
169
|
+
has been advised of the possibility of such damages.
|
|
170
|
+
|
|
171
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
172
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
173
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
174
|
+
or other liability obligations and/or rights consistent with this
|
|
175
|
+
License. However, in accepting such obligations, You may act only
|
|
176
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
177
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
178
|
+
defend, and hold each Contributor harmless for any liability
|
|
179
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
180
|
+
of your accepting any such warranty or additional liability.
|
|
181
|
+
|
|
182
|
+
END OF TERMS AND CONDITIONS
|
|
183
|
+
|
|
184
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
185
|
+
|
|
186
|
+
To apply the Apache License to your work, attach the following
|
|
187
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
188
|
+
replaced with your own identifying information. (Don't include
|
|
189
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
190
|
+
comment syntax for the file format. We also recommend that a
|
|
191
|
+
file or class name and description of purpose be included on the
|
|
192
|
+
same "printed page" as the copyright notice for easier
|
|
193
|
+
identification within third-party archives.
|
|
194
|
+
|
|
195
|
+
Copyright [yyyy] [name of copyright owner]
|
|
196
|
+
|
|
197
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
198
|
+
you may not use this file except in compliance with the License.
|
|
199
|
+
You may obtain a copy of the License at
|
|
200
|
+
|
|
201
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
202
|
+
|
|
203
|
+
Unless required by applicable law or agreed to in writing, software
|
|
204
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
205
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
206
|
+
See the License for the specific language governing permissions and
|
|
207
|
+
limitations under the License.
|
|
208
|
+
|
|
209
|
+
Requires-Python: >=3.9
|
|
210
|
+
Description-Content-Type: text/markdown
|
|
211
|
+
License-File: LICENSE
|
|
212
|
+
Requires-Dist: click==8.*
|
|
213
|
+
Requires-Dist: httpx==0.27.*
|
|
214
|
+
Requires-Dist: ijson==3.*
|
|
215
|
+
Requires-Dist: pyyaml==6.*
|
|
216
|
+
Requires-Dist: regex
|
|
217
|
+
Requires-Dist: responses==0.21.*
|
|
218
|
+
Requires-Dist: sentry-sdk>=2.20.0
|
|
219
|
+
Requires-Dist: test-results-parser==0.5.*
|
|
220
|
+
Requires-Dist: tree-sitter==0.20.*
|
|
221
|
+
Requires-Dist: wrapt>=1.17.2
|
|
222
|
+
|
|
223
|
+
# CodecovCLI
|
|
224
|
+
|
|
225
|
+
[](https://codecov.io/gh/codecov/codecov-cli)
|
|
226
|
+
[](https://github.com/codecov/codecov-cli/actions/workflows/push_flow.yml)
|
|
227
|
+
|
|
228
|
+
CodecovCLI is a new way for users to interact with Codecov directly from the user’s terminal or CI platform. Many Codecov features that require the user’s interference can be done via the codecovCLI. It saves commits, creates reports, uploads coverage and has many more features.
|
|
229
|
+
|
|
230
|
+
- [CodecovCLI](#codecovcli)
|
|
231
|
+
- [Installing](#installing)
|
|
232
|
+
- [Using PIP](#using-pip)
|
|
233
|
+
- [As a Binary](#as-a-binary)
|
|
234
|
+
- [Integrity Checking the Binary](#integrity-checking-the-binary)
|
|
235
|
+
- [How to Upload to Codecov](#how-to-upload-to-codecov)
|
|
236
|
+
- [How to Get an Upload Token](#how-to-get-an-upload-token)
|
|
237
|
+
- [Usage](#usage)
|
|
238
|
+
- [Codecov-cli Commands](#codecov-cli-commands)
|
|
239
|
+
- [create-commit](#create-commit)
|
|
240
|
+
- [create-report](#create-report)
|
|
241
|
+
- [do-upload](#do-upload)
|
|
242
|
+
- [create-report-results](#create-report-results)
|
|
243
|
+
- [get-report-results](#get-report-results)
|
|
244
|
+
- [pr-base-picking](#pr-base-picking)
|
|
245
|
+
- [send-notifications](#send-notifications)
|
|
246
|
+
- [empty-upload](#empty-upload)
|
|
247
|
+
- [How to Use Local Upload](#how-to-use-local-upload)
|
|
248
|
+
- [Work in Progress Features](#work-in-progress-features)
|
|
249
|
+
- [Plugin System](#plugin-system)
|
|
250
|
+
- [Static Analysis](#static-analysis)
|
|
251
|
+
- [Contributions](#contributions)
|
|
252
|
+
- [Requirements](#requirements)
|
|
253
|
+
- [Guidelines](#guidelines)
|
|
254
|
+
- [Dependencies](#dependencies)
|
|
255
|
+
- [Releases](#releases)
|
|
256
|
+
|
|
257
|
+
# Installing
|
|
258
|
+
|
|
259
|
+
## Using PIP
|
|
260
|
+
To use codecov-cli in your local machine, or your CI workflows, you need to install it:
|
|
261
|
+
|
|
262
|
+
`pip install codecov-cli`
|
|
263
|
+
|
|
264
|
+
The above command will download the latest version of Codecov-cli. If you wish to use a specific version, releases can be viewed [here](https://pypi.org/project/codecov-cli/#history).
|
|
265
|
+
|
|
266
|
+
Note: If you're installing in a `pyenv` environment, you may need to call `pyenv rehash` before the CLI will work.
|
|
267
|
+
|
|
268
|
+
## As a Binary
|
|
269
|
+
If you would like to use the CLI in an environment that does not have access to Python / PIP, you can install the CLI as a compiled binary. Linux and macOS releases can be found [here](https://cli.codecov.io/), along with SHASUMs and signatures for each released version. Binary releases are also available via [Github releases](https://github.com/codecov/codecov-cli/releases) on this repository.
|
|
270
|
+
|
|
271
|
+
You can retrieve the Binary for Linux directly from your command line as follows:
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
275
|
+
sudo chmod +x codecov
|
|
276
|
+
./codecov --help
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Integrity Checking the Binary
|
|
280
|
+
|
|
281
|
+
The binary can be integrity checked using a SHASUM256 and SHASUM256.sig file. The process for macos and Linux is identical. Linux is as follows:
|
|
282
|
+
|
|
283
|
+
```
|
|
284
|
+
curl https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import # One-time step
|
|
285
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov
|
|
286
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM
|
|
287
|
+
curl -Os https://cli.codecov.io/latest/linux/codecov.SHA256SUM.sig
|
|
288
|
+
|
|
289
|
+
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
|
|
290
|
+
|
|
291
|
+
shasum -a 256 -c codecov.SHA256SUM
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
For macos you will want to use the macos distributions of the binary (e.g., https://cli.codecov.io/latest/macos/codecov)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
# How to Upload to Codecov
|
|
298
|
+
If desired, the CLI can be used as a replacement for our [NodeJS Binary Uploader](https://github.com/codecov/uploader). To use the CLI to upload from your CI workflow, you need to add these commands:
|
|
299
|
+
|
|
300
|
+
```
|
|
301
|
+
pip install codecov-cli
|
|
302
|
+
codecovcli create-commit
|
|
303
|
+
codecovcli create-report
|
|
304
|
+
codecovcli do-upload
|
|
305
|
+
```
|
|
306
|
+
OR
|
|
307
|
+
```
|
|
308
|
+
pip install codecov-cli
|
|
309
|
+
codecovcli upload-process
|
|
310
|
+
```
|
|
311
|
+
codecovcli upload-process is a wrapper for create-commit, create-report and do-upload.
|
|
312
|
+
|
|
313
|
+
You can customize the commands with the options aligned with each command.
|
|
314
|
+
|
|
315
|
+
Note that these commands will automatically search your environment for a `$CODECOV_TOKEN` environment variable and use it if found. If you do not have a repository upload token, or global upload token, stored as an environment variable, you will need to pass it into **each command manually**, like so: `-t {$CODECOV_TOKEN}`.
|
|
316
|
+
|
|
317
|
+
## How to Get an Upload Token
|
|
318
|
+
The following tokens are suitable for uploading:
|
|
319
|
+
|
|
320
|
+
* The [Repository Upload Token](https://docs.codecov.com/docs/codecov-uploader#upload-token): Found on the settings page of your repository, also viewable on the `/new` page when setting up a repository on Codecov for the first time.
|
|
321
|
+
* The [Global Upload Token](https://docs.codecov.com/docs/codecov-uploader#organization-upload-token): Found on your organization settings page (e.g., `https://app.codecov.io/account/<scm>/<org>/org-upload-token`).
|
|
322
|
+
|
|
323
|
+
# Usage
|
|
324
|
+
If the installation is successful, running `codecovcli --help` will output the available commands along with the different general options that can be used with them.
|
|
325
|
+
|
|
326
|
+
> [!IMPORTANT]
|
|
327
|
+
> For up-to-date command usage, please check the `codecovcli_commands` [file](https://github.com/codecov/codecov-cli/blob/main/codecovcli_commands)
|
|
328
|
+
|
|
329
|
+
```
|
|
330
|
+
Usage: codecovcli [OPTIONS] COMMAND [ARGS]...
|
|
331
|
+
```
|
|
332
|
+
Codecov-cli supports user input. These inputs, along with their descriptions and usage contexts, are listed in the table below:
|
|
333
|
+
|
|
334
|
+
| Input | Description | Usage |
|
|
335
|
+
| :---: | :---: | :---: |
|
|
336
|
+
| `--auto-load-params-from` | The CI/CD platform | Optional |
|
|
337
|
+
| `--codecov-yml-path` | The path for your codecov.yml | Optional
|
|
338
|
+
| `--enterprise-url` | Change the upload host (Enterprise use) | Optional
|
|
339
|
+
| `--version` | Codecov-cli's version | Optional
|
|
340
|
+
| `--verbose` or `-v` | Run the cli with verbose logging | Optional
|
|
341
|
+
|
|
342
|
+
# Codecov-cli Commands
|
|
343
|
+
| Command | Description |
|
|
344
|
+
| :---: | :---: |
|
|
345
|
+
| `create-commit` | Saves the commit's metadata in codecov, it's only necessary to run this once per commit
|
|
346
|
+
| `create-report` | Creates an empty report in codecov with initial data e.g. report name, report's commit
|
|
347
|
+
| `do-upload` | Searches for and uploads coverage data to codecov
|
|
348
|
+
| `create-report-results` | Used for local upload. It tells codecov that you finished local uploading and want it to calculate the results for you to get them locally.
|
|
349
|
+
| `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command.
|
|
350
|
+
| `pr-base-picking` | Tells codecov that you want to explicitly define a base for your PR
|
|
351
|
+
| `upload-process` | A wrapper for 3 commands. Create-commit, create-report and do-upload. You can use this command to upload to codecov instead of using the previosly mentioned commands.
|
|
352
|
+
| `send-notifications` | A command that tells Codecov that you finished uploading and you want to be sent notifications. To disable automatically sent notifications please consider adding manual_trigger to your codecov.yml, so it will look like codecov: notify: manual_trigger: true.
|
|
353
|
+
>**Note**: Every command has its own different options that will be mentioned later in this doc. Codecov will try to load these options from your CI environment variables, if not, it will try to load them from git, if not found, you may need to add them manually.
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
## create-commit
|
|
358
|
+
`codecovcli create-commit [Options]`
|
|
359
|
+
|
|
360
|
+
| Option | Description | Usage
|
|
361
|
+
| :---: | :---: | :---: |
|
|
362
|
+
| -C, --sha, --commit-sha | Commit SHA (with 40 chars) | Required
|
|
363
|
+
|--parent-sha | SHA (with 40 chars) of what should be the parent of this commit | Optional
|
|
364
|
+
|-P, --pr, --pull-request-number| Specify the pull request number manually. Used to override pre-existing CI environment variables | Optional
|
|
365
|
+
|-B, --branch | Branch to which this commit belongs to | Optional
|
|
366
|
+
|-r, --slug | owner/repo slug used instead of the private repo token in Self-hosted | Required
|
|
367
|
+
|-t, --token | Codecov upload token | Required
|
|
368
|
+
|--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required
|
|
369
|
+
|-h, --help | Shows usage, and command options
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
## create-report
|
|
373
|
+
`codecovcli create-report [OPTIONS]`
|
|
374
|
+
|
|
375
|
+
| Option | Description | Usage
|
|
376
|
+
| :---: | :---: | :---: |
|
|
377
|
+
| -C, --sha, --commit-sha | Commit SHA (with 40 chars) | Required
|
|
378
|
+
|-r, --slug | owner/repo slug used instead of the private repo token in Self-hosted | Required
|
|
379
|
+
|-t, --token | Codecov upload token | Required
|
|
380
|
+
|--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required
|
|
381
|
+
|--code| The code of the report. This is used in local uploading to isolate local reports from regular or cloud reports uploaded to codecov so they don't get merged. It's basically a name you give to your report e.g. local-report. | Optional
|
|
382
|
+
|-h, --help | Shows usage, and command options
|
|
383
|
+
|
|
384
|
+
## do-upload
|
|
385
|
+
`codecovcli do-upload [OPTIONS]`
|
|
386
|
+
|
|
387
|
+
| Option | Description | Usage
|
|
388
|
+
| :---: | :---: | :---: |
|
|
389
|
+
|-C, --sha, --commit-sha| Commit SHA (with 40 chars) | Required
|
|
390
|
+
|--report-code | The code of the report defined when creating the report. If unsure, leave default | Optional
|
|
391
|
+
|--network-root-folder | Root folder from which to consider paths on the network section default: (Current working directory) | Optional
|
|
392
|
+
|-s, --dir, --coverage-files-search-root-folder | Folder where to search for coverage files default: (Current Working Directory) | Optional
|
|
393
|
+
|--exclude, --coverage-files-search-exclude-folder | Folders to exclude from search | Optional
|
|
394
|
+
|-f, --file, --coverage-files-search-direct-file | Explicit files to upload | Optional
|
|
395
|
+
|--disable-search | Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.| Optional
|
|
396
|
+
|-b, --build, --build-code | Specify the build number manually | Optional
|
|
397
|
+
|--build-url | The URL of the build where this is running | Optional
|
|
398
|
+
|--job-code | The job code for the CI run | Optional
|
|
399
|
+
|-t, --token | Codecov upload token | Required
|
|
400
|
+
|-n, --name | Custom defined name of the upload. Visible in Codecov UI | Optional
|
|
401
|
+
|-B, --branch | Branch to which this commit belongs to | Optional
|
|
402
|
+
|-r, --slug | owner/repo slug | Required
|
|
403
|
+
|-P, --pr, --pull-request-number | Specify the pull request number manually. Used to override pre-existing CI environment variables | Optional
|
|
404
|
+
|-e, --env, --env-var | Specify environment variables to be included with this build. | Optional
|
|
405
|
+
|-F, --flag | Flag the upload to group coverage metrics. Multiple flags allowed. | Optional
|
|
406
|
+
|--plugin | plugins to run. Options: xcode, gcov, pycoverage. The default behavior runs them all. | Optional
|
|
407
|
+
|-Z, --fail-on-error | Exit with non-zero code in case of error uploading.|Optional
|
|
408
|
+
|-d, --dry-run | Don't upload files to Codecov | Optional
|
|
409
|
+
|--legacy, --use-legacy-uploader | Use the legacy upload endpoint | Optional
|
|
410
|
+
|--git-service | Git Provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Required
|
|
411
|
+
|-h, --help | Shows usage, and command options
|
|
412
|
+
|
|
413
|
+
## create-report-results
|
|
414
|
+
`codecovcli create-report-results [OPTIONS]`
|
|
415
|
+
|
|
416
|
+
| Option | Description | Usage
|
|
417
|
+
| :---: | :---: | :---: |
|
|
418
|
+
|--commit-sha | Commit SHA (with 40 chars) | Required
|
|
419
|
+
|--code | The code of the report. If unsure, leave default | Required
|
|
420
|
+
|--slug | owner/repo slug | Required
|
|
421
|
+
|--git-service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional
|
|
422
|
+
|-t, --token | Codecov upload token | Required
|
|
423
|
+
|-h, --help | Shows usage, and command options
|
|
424
|
+
|
|
425
|
+
## get-report-results
|
|
426
|
+
`codecovcli get-report-results [OPTIONS]`
|
|
427
|
+
|
|
428
|
+
| Option | Description | Usage
|
|
429
|
+
| :---: | :---: | :---: |
|
|
430
|
+
|--commit-sha | Commit SHA (with 40 chars) | Required
|
|
431
|
+
|--code | The code of the report. If unsure, leave default | Required
|
|
432
|
+
|--slug | owner/repo slug | Required
|
|
433
|
+
|--git-service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional
|
|
434
|
+
|-t, --token | Codecov upload token | Required
|
|
435
|
+
|-h, --help | Shows usage, and command options
|
|
436
|
+
|
|
437
|
+
## pr-base-picking
|
|
438
|
+
`codecovcli pr-base-picking [OPTIONS]`
|
|
439
|
+
|
|
440
|
+
| Option | Description | Usage
|
|
441
|
+
| :---: | :---: | :---: |
|
|
442
|
+
|--base-sha | Base commit SHA (with 40 chars) | Required
|
|
443
|
+
|--pr | Pull Request id to associate commit with | Required
|
|
444
|
+
|--slug | owner/repo slug | Required
|
|
445
|
+
|-t, --token| Codecov upload token | Required
|
|
446
|
+
|--service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional
|
|
447
|
+
|-h, --help | Shows usage, and command options
|
|
448
|
+
|
|
449
|
+
## send-notifications
|
|
450
|
+
`codecovcli send-notifications [OPTIONS]`
|
|
451
|
+
|
|
452
|
+
| Option | Description | Usage
|
|
453
|
+
| :---: | :---: | :---: |
|
|
454
|
+
| -C, --sha, --commit-sha TEXT |Commit SHA (with 40 chars) | Required
|
|
455
|
+
| -r, --slug TEXT |owner/repo slug used instead of the private repo token in Self-hosted | Required
|
|
456
|
+
| -t, --token TEXT |Codecov upload token | Required
|
|
457
|
+
| --git-service | Git provider. Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional
|
|
458
|
+
| -h,--help |Show this message and exit.
|
|
459
|
+
|
|
460
|
+
## empty-upload
|
|
461
|
+
|
|
462
|
+
Used if the changes made don't need testing, but PRs require a passing codecov status to be merged.
|
|
463
|
+
This command will scan the files in the commit and send passing status checks configured if all the changed files
|
|
464
|
+
are ignored by codecov (including README and configuration files)
|
|
465
|
+
|
|
466
|
+
`Usage: codecovcli empty-upload [OPTIONS]`
|
|
467
|
+
|
|
468
|
+
| Options | Description | usage |
|
|
469
|
+
| :--------------------------: | :----------------------------------------------------------------------------------------: | :------: |
|
|
470
|
+
| -C, --sha, --commit-sha TEXT | Commit SHA (with 40 chars) | Required |
|
|
471
|
+
| -t, --token TEXT | Codecov upload token | Required |
|
|
472
|
+
| -r, --slug TEXT | owner/repo slug used instead of the private repo token in Self-hosted | Optional |
|
|
473
|
+
| --force | Always emit passing checks regardless of changed files | Optional |
|
|
474
|
+
| -Z, --fail-on-error | Exit with non-zero code in case of error | Optional |
|
|
475
|
+
| --git-service | Options: github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server | Optional |
|
|
476
|
+
| -h, --help | Show this message and exit. | Optional |
|
|
477
|
+
|
|
478
|
+
# How to Use Local Upload
|
|
479
|
+
|
|
480
|
+
The CLI also supports "dry run" local uploading. This is useful if you prefer to see Codecov status checks and coverage reporting locally, in your terminal, as opposed to opening a PR and waiting for your full CI to run. Local uploads do not interfere with regular uploads made from your CI for any given commit / Pull Request.
|
|
481
|
+
|
|
482
|
+
Local Upload is accomplished as follows:
|
|
483
|
+
|
|
484
|
+
```
|
|
485
|
+
pip install codecov-cli
|
|
486
|
+
codecovcli create-commit
|
|
487
|
+
codecovcli create-report --code <CODE>
|
|
488
|
+
codecovcli do-upload --report-code <CODE>
|
|
489
|
+
codecovcli create-report-results --code <CODE>
|
|
490
|
+
codecovcli get-report-results --code <CODE>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Codecov will calculate the coverage results, and return them in your terminal, telling you whether your PR will fail or pass the coverage check.
|
|
494
|
+
|
|
495
|
+
Note: In order for Local Upload to work, it must be used against a commit on the origin repository. Local Upload does not work for arbitrary diffs or uncommitted changes on your local machine.
|
|
496
|
+
|
|
497
|
+
# Work in Progress Features
|
|
498
|
+
|
|
499
|
+
The following features are somewhat implemented in code, but are not yet meant for use. These features will be documented once they are fully implemented in the CLI.
|
|
500
|
+
|
|
501
|
+
## Plugin System
|
|
502
|
+
|
|
503
|
+
To provide extensibility to some of its commands, the CLI makes use of a plugin system. For most cases, the default commands are sufficient. But in some cases, having some custom logic specific to your use case can be beneficial. Note that full documentation of the plugin system is pending, as the feature is still heavily a work in progress.
|
|
504
|
+
|
|
505
|
+
## Static Analysis
|
|
506
|
+
|
|
507
|
+
The CLI can perform basic static analysis on Python code today. This static analysis is meant to power more future looking Codecov features and, as such, is not required or in active use today. As more functionality dependent on static analysis becomes available for use, we will document static analysis in detail here.
|
|
508
|
+
|
|
509
|
+
# Contributions
|
|
510
|
+
|
|
511
|
+
This repository, like all of Codecov's repositories, strives to follow our general [Contributing guidelines](https://github.com/codecov/contributing). If you're considering making a contribution to this repository, we encourage review of our Contributing guidelines first.
|
|
512
|
+
|
|
513
|
+
## Requirements
|
|
514
|
+
|
|
515
|
+
Most of this package is a very conventional Python package. The main difference is the static the CLI's analysis module uses both git submodules and C code
|
|
516
|
+
|
|
517
|
+
Before installing, one should pull the submodules with:
|
|
518
|
+
|
|
519
|
+
```
|
|
520
|
+
git submodule update --init
|
|
521
|
+
```
|
|
522
|
+
Then, install dependencies with
|
|
523
|
+
```
|
|
524
|
+
pip install -r requirements.txt
|
|
525
|
+
python -m pip install --editable .
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
The C code shouldn't require any additional setup to get running, but depending on your environment, you may be prompted to install compilers and supporting tools. If errors are generated during installation, it is likely due to missing dependencies / tools required of the C code. In many cases, resulting error messages should be clear enough to determine what is missing and how to install it, but common errors will be collected here as they are encountered.
|
|
529
|
+
|
|
530
|
+
## Guidelines
|
|
531
|
+
|
|
532
|
+
There are a few guidelines when developing in this system. Some notable folders:
|
|
533
|
+
|
|
534
|
+
1. `commands` - It's the folder that interacts with the caller. This is where the commands themselves should reside. These commands are not meant to do heavy lifting. They only do wiring, which is mostly parsing the input parameters.
|
|
535
|
+
2. `services` - It's where the heavy logic resides. It's mostly organized by which command needs them. Commands should generally be thin wrappers around these services.
|
|
536
|
+
3. `helpers` - This is meant for logic that is useful across different commands. For example, logging helpers, or the logic that searches folders.
|
|
537
|
+
|
|
538
|
+
## Dependencies
|
|
539
|
+
|
|
540
|
+
If external dependencies need to be added, it's important to check whether those dependencies have wheels available on PyPI with the `any` or `universal2` platform tags. If those dependencies don't have those wheels available, then they will need to built during the CI, so they will have to be added to the list of
|
|
541
|
+
dependencies in the `--no-binary` flag when building the requirements for the macos release in `build_assets.yml`.
|
|
542
|
+
|
|
543
|
+
# Releases
|
|
544
|
+
|
|
545
|
+
The standard way to making a new release is the following:
|
|
546
|
+
1) Open a PR that increases the version number in pyproject.toml. As a rule of thumb, just add one to the micro/patch version (e.g., v0.1.6 -> v0.1.7).
|
|
547
|
+
|
|
548
|
+
2) Get the up-to-date master branch locally and run the `tag.release` command from the Makefile.
|
|
549
|
+
|
|
550
|
+
`$ make tag.release version=v<VERSION_NUM>`
|
|
551
|
+
|
|
552
|
+
The version tag must match the regex defined on the Makefile (`tag_regex := ^v([0-9]{1,}\.){2}[0-9]{1,}([-_]\w+)?$`).
|
|
553
|
+
|
|
554
|
+
>**Note**: \
|
|
555
|
+
>Releases with `test` word in them are created as `draft`. \
|
|
556
|
+
>Releases with `beta` word in them are created as `pre-release`.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
staticcodecov_languages.cp313-win32.pyd,sha256=UoHylSGFx4Slxj_sVcSWH4_GkFnNJyduWufxNjvUfdU,686080
|
|
2
|
+
codecov_cli/__init__.py,sha256=hWfN84Z7wNwv8TjbBU_3n6U-OZALZP3SAvdA5bCbaJA,83
|
|
3
|
+
codecov_cli/fallbacks.py,sha256=gNN40jmBY8bBdjU6il1w2pJfzNGczI6Exg9JXVJxCbg,1278
|
|
4
|
+
codecov_cli/main.py,sha256=HT28SVu6jPLGAg8a9n48AU7a2MrswJ59FUVP4jGCa_w,3448
|
|
5
|
+
codecov_cli/opentelemetry.py,sha256=lf71n88W0GNRW8of0SERiWcpjAoap5zIqY0DVk2PyV0,592
|
|
6
|
+
codecov_cli/types.py,sha256=op8oIkyLhh874tztrt0sDBkzOpb3tUFaSExGae314TM,2159
|
|
7
|
+
codecov_cli-10.1.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
8
|
+
codecov_cli-10.1.0.dist-info/METADATA,sha256=_Chewf0v_PsuzQ3j2drBR7sVcV4rwebVO176RcQC1FU,33576
|
|
9
|
+
codecov_cli-10.1.0.dist-info/WHEEL,sha256=DFEd4wH53WDAEWJlYTy3wsIIOJTkJ3-fMddO9UbJavY,97
|
|
10
|
+
codecov_cli-10.1.0.dist-info/entry_points.txt,sha256=u2LV1TxZeZWZLVaKWqhZiWOJD-YTTZbpjDe_Wdh978Q,83
|
|
11
|
+
codecov_cli-10.1.0.dist-info/top_level.txt,sha256=ZKJTOeMHeTqvl-t_8GcnbgwPloQxqgTxyqsOfC9aOvU,36
|
|
12
|
+
codecov_cli-10.1.0.dist-info/RECORD,,
|
|
Binary file
|