codecov-cli 0.4.8__tar.gz → 0.5.0__tar.gz

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.
Files changed (99) hide show
  1. {codecov-cli-0.4.8/codecov_cli.egg-info → codecov-cli-0.5.0}/PKG-INFO +2 -2
  2. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/README.md +1 -1
  3. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/upload.py +61 -47
  4. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/upload_process.py +2 -0
  5. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/request.py +13 -1
  6. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/versioning_systems.py +23 -3
  7. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/upload/__init__.py +24 -17
  8. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/upload/file_finder.py +1 -2
  9. codecov-cli-0.5.0/codecov_cli/services/upload/network_finder.py +43 -0
  10. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/upload/upload_collector.py +19 -13
  11. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/upload/upload_sender.py +1 -0
  12. {codecov-cli-0.4.8 → codecov-cli-0.5.0/codecov_cli.egg-info}/PKG-INFO +2 -2
  13. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/setup.py +1 -1
  14. codecov-cli-0.4.8/codecov_cli/services/upload/network_finder.py +0 -21
  15. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/LICENSE +0 -0
  16. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/MANIFEST.in +0 -0
  17. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/__init__.py +0 -0
  18. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/__init__.py +0 -0
  19. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/base_picking.py +0 -0
  20. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/commit.py +0 -0
  21. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/create_report_result.py +0 -0
  22. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/empty_upload.py +0 -0
  23. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/get_report_results.py +0 -0
  24. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/labelanalysis.py +0 -0
  25. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/report.py +0 -0
  26. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/send_notifications.py +0 -0
  27. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/commands/staticanalysis.py +0 -0
  28. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/fallbacks.py +0 -0
  29. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/__init__.py +0 -0
  30. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/__init__.py +0 -0
  31. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/appveyor_ci.py +0 -0
  32. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/azure_pipelines.py +0 -0
  33. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/base.py +0 -0
  34. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/bitbucket_ci.py +0 -0
  35. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/bitrise_ci.py +0 -0
  36. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/buildkite.py +0 -0
  37. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/circleci.py +0 -0
  38. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/cirrus_ci.py +0 -0
  39. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/codebuild.py +0 -0
  40. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/droneci.py +0 -0
  41. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/github_actions.py +0 -0
  42. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/gitlab_ci.py +0 -0
  43. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/heroku.py +0 -0
  44. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/jenkins.py +0 -0
  45. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/local.py +0 -0
  46. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/teamcity.py +0 -0
  47. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/travis_ci.py +0 -0
  48. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/ci_adapters/woodpeckerci.py +0 -0
  49. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/config.py +0 -0
  50. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/encoder.py +0 -0
  51. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/folder_searcher.py +0 -0
  52. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/git.py +0 -0
  53. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/git_services/__init__.py +0 -0
  54. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/git_services/github.py +0 -0
  55. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/logging_utils.py +0 -0
  56. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/options.py +0 -0
  57. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/helpers/validators.py +0 -0
  58. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/main.py +0 -0
  59. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/plugins/__init__.py +0 -0
  60. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/plugins/compress_pycoverage_contexts.py +0 -0
  61. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/plugins/gcov.py +0 -0
  62. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/plugins/pycoverage.py +0 -0
  63. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/plugins/types.py +0 -0
  64. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/plugins/xcode.py +0 -0
  65. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/runners/__init__.py +0 -0
  66. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/runners/dan_runner.py +0 -0
  67. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/runners/pytest_standard_runner.py +0 -0
  68. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/runners/types.py +0 -0
  69. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/__init__.py +0 -0
  70. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/commit/__init__.py +0 -0
  71. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/commit/base_picking.py +0 -0
  72. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/empty_upload/__init__.py +0 -0
  73. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/report/__init__.py +0 -0
  74. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/__init__.py +0 -0
  75. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/analyzers/__init__.py +0 -0
  76. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/analyzers/general.py +0 -0
  77. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/analyzers/javascript_es6/__init__.py +0 -0
  78. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/analyzers/javascript_es6/node_wrappers.py +0 -0
  79. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/analyzers/python/__init__.py +0 -0
  80. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/analyzers/python/node_wrappers.py +0 -0
  81. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/exceptions.py +0 -0
  82. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/finders.py +0 -0
  83. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/staticanalysis/types.py +0 -0
  84. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/upload/legacy_upload_sender.py +0 -0
  85. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/services/upload_completion/__init__.py +0 -0
  86. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli/types.py +0 -0
  87. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli.egg-info/SOURCES.txt +0 -0
  88. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli.egg-info/dependency_links.txt +0 -0
  89. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli.egg-info/entry_points.txt +0 -0
  90. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli.egg-info/requires.txt +0 -0
  91. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/codecov_cli.egg-info/top_level.txt +0 -0
  92. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/languages.c +0 -0
  93. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/treesitterjavascript/src/parser.c +0 -0
  94. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/treesitterjavascript/src/scanner.c +0 -0
  95. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/treesitterjavascript/src/tree_sitter/parser.h +0 -0
  96. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/treesitterpython/src/parser.c +0 -0
  97. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/treesitterpython/src/scanner.cc +0 -0
  98. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/languages/treesitterpython/src/tree_sitter/parser.h +0 -0
  99. {codecov-cli-0.4.8 → codecov-cli-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codecov-cli
3
- Version: 0.4.8
3
+ Version: 0.5.0
4
4
  Summary: Codecov Command Line Interface
5
5
  Author: Codecov
6
6
  Author-email: support@codecov.io
@@ -134,7 +134,7 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
134
134
  | `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command.
135
135
  | `pr-base-picking` | Tells codecov that you want to explicitly define a base for your PR
136
136
  | `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.
137
- | `send-notification` | 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.
137
+ | `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.
138
138
  >**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.
139
139
 
140
140
 
@@ -124,7 +124,7 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
124
124
  | `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command.
125
125
  | `pr-base-picking` | Tells codecov that you want to explicitly define a base for your PR
126
126
  | `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.
127
- | `send-notification` | 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.
127
+ | `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.
128
128
  >**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.
129
129
 
130
130
 
@@ -63,7 +63,7 @@ _global_upload_options = [
63
63
  ),
64
64
  click.option(
65
65
  "--disable-search",
66
- help="Disable search for coverage files. This is helpful when specifying what files you want to uload with the --file option.",
66
+ help="Disable search for coverage files. This is helpful when specifying what files you want to upload with the --file option.",
67
67
  is_flag=True,
68
68
  default=False,
69
69
  ),
@@ -164,6 +164,14 @@ _global_upload_options = [
164
164
  default="coverage",
165
165
  type=click.Choice(["coverage", "test_results"]),
166
166
  ),
167
+ click.option(
168
+ "--network-filter",
169
+ help="Specify a filter on the files listed in the network section of the Codecov report. This will only add files whose path begin with the specified filter. Useful for upload-specific path fixing",
170
+ ),
171
+ click.option(
172
+ "--network-prefix",
173
+ help="Specify a prefix on files listed in the network section of the Codecov report. Useful to help resolve path fixing",
174
+ ),
167
175
  ]
168
176
 
169
177
 
@@ -181,29 +189,31 @@ def do_upload(
181
189
  ctx: click.Context,
182
190
  commit_sha: str,
183
191
  report_code: str,
192
+ branch: typing.Optional[str],
184
193
  build_code: typing.Optional[str],
185
194
  build_url: typing.Optional[str],
186
- job_code: typing.Optional[str],
195
+ disable_file_fixes: bool,
196
+ disable_search: bool,
197
+ dry_run: bool,
187
198
  env_vars: typing.Dict[str, str],
199
+ fail_on_error: bool,
200
+ files_search_exclude_folders: typing.List[pathlib.Path],
201
+ files_search_explicitly_listed_files: typing.List[pathlib.Path],
202
+ files_search_root_folder: pathlib.Path,
188
203
  flags: typing.List[str],
204
+ git_service: typing.Optional[str],
205
+ handle_no_reports_found: bool,
206
+ job_code: typing.Optional[str],
189
207
  name: typing.Optional[str],
208
+ network_filter: typing.Optional[str],
209
+ network_prefix: typing.Optional[str],
190
210
  network_root_folder: pathlib.Path,
191
- files_search_root_folder: pathlib.Path,
192
- files_search_exclude_folders: typing.List[pathlib.Path],
193
- files_search_explicitly_listed_files: typing.List[pathlib.Path],
194
- disable_search: bool,
195
- disable_file_fixes: bool,
196
- token: typing.Optional[str],
197
211
  plugin_names: typing.List[str],
198
- branch: typing.Optional[str],
199
- slug: typing.Optional[str],
200
212
  pull_request_number: typing.Optional[str],
201
- use_legacy_uploader: bool,
202
- fail_on_error: bool,
203
- dry_run: bool,
204
- git_service: typing.Optional[str],
205
- handle_no_reports_found: bool,
206
213
  report_type: str,
214
+ slug: typing.Optional[str],
215
+ token: typing.Optional[str],
216
+ use_legacy_uploader: bool,
207
217
  ):
208
218
  versioning_system = ctx.obj["versioning_system"]
209
219
  codecov_yaml = ctx.obj["codecov_yaml"] or {}
@@ -214,29 +224,31 @@ def do_upload(
214
224
  "Starting upload processing",
215
225
  extra=dict(
216
226
  extra_log_attributes=dict(
217
- upload_file_type=report_type,
218
- commit_sha=commit_sha,
219
- report_code=report_code,
227
+ branch=branch,
220
228
  build_code=build_code,
221
229
  build_url=build_url,
222
- job_code=job_code,
230
+ commit_sha=commit_sha,
231
+ disable_file_fixes=disable_file_fixes,
232
+ disable_search=disable_search,
233
+ enterprise_url=enterprise_url,
223
234
  env_vars=env_vars,
235
+ files_search_exclude_folders=files_search_exclude_folders,
236
+ files_search_explicitly_listed_files=files_search_explicitly_listed_files,
237
+ files_search_root_folder=files_search_root_folder,
224
238
  flags=flags,
239
+ git_service=git_service,
240
+ handle_no_reports_found=handle_no_reports_found,
241
+ job_code=job_code,
225
242
  name=name,
243
+ network_filter=network_filter,
244
+ network_prefix=network_prefix,
226
245
  network_root_folder=network_root_folder,
227
- files_search_root_folder=files_search_root_folder,
228
- files_search_exclude_folders=files_search_exclude_folders,
229
- files_search_explicitly_listed_files=files_search_explicitly_listed_files,
230
246
  plugin_names=plugin_names,
231
- token=token,
232
- branch=branch,
233
- slug=slug,
234
247
  pull_request_number=pull_request_number,
235
- git_service=git_service,
236
- enterprise_url=enterprise_url,
237
- disable_search=disable_search,
238
- disable_file_fixes=disable_file_fixes,
239
- handle_no_reports_found=handle_no_reports_found,
248
+ report_code=report_code,
249
+ slug=slug,
250
+ token=token,
251
+ upload_file_type=report_type,
240
252
  )
241
253
  ),
242
254
  )
@@ -244,30 +256,32 @@ def do_upload(
244
256
  cli_config,
245
257
  versioning_system,
246
258
  ci_adapter,
247
- upload_file_type=report_type,
248
- commit_sha=commit_sha,
249
- report_code=report_code,
259
+ branch=branch,
250
260
  build_code=build_code,
251
261
  build_url=build_url,
252
- job_code=job_code,
262
+ commit_sha=commit_sha,
263
+ disable_file_fixes=disable_file_fixes,
264
+ disable_search=disable_search,
265
+ dry_run=dry_run,
266
+ enterprise_url=enterprise_url,
253
267
  env_vars=env_vars,
268
+ fail_on_error=fail_on_error,
269
+ files_search_exclude_folders=list(files_search_exclude_folders),
270
+ files_search_explicitly_listed_files=list(files_search_explicitly_listed_files),
271
+ files_search_root_folder=files_search_root_folder,
254
272
  flags=flags,
273
+ git_service=git_service,
274
+ handle_no_reports_found=handle_no_reports_found,
275
+ job_code=job_code,
255
276
  name=name,
277
+ network_filter=network_filter,
278
+ network_prefix=network_prefix,
256
279
  network_root_folder=network_root_folder,
257
- files_search_root_folder=files_search_root_folder,
258
- files_search_exclude_folders=list(files_search_exclude_folders),
259
- files_search_explicitly_listed_files=list(files_search_explicitly_listed_files),
260
280
  plugin_names=plugin_names,
261
- token=token,
262
- branch=branch,
263
- slug=slug,
264
281
  pull_request_number=pull_request_number,
282
+ report_code=report_code,
283
+ slug=slug,
284
+ token=token,
285
+ upload_file_type=report_type,
265
286
  use_legacy_uploader=use_legacy_uploader,
266
- fail_on_error=fail_on_error,
267
- dry_run=dry_run,
268
- git_service=git_service,
269
- enterprise_url=enterprise_url,
270
- disable_search=disable_search,
271
- handle_no_reports_found=handle_no_reports_found,
272
- disable_file_fixes=disable_file_fixes,
273
287
  )
@@ -31,6 +31,8 @@ def upload_process(
31
31
  env_vars: typing.Dict[str, str],
32
32
  flags: typing.List[str],
33
33
  name: typing.Optional[str],
34
+ network_filter: typing.Optional[str],
35
+ network_prefix: typing.Optional[str],
34
36
  network_root_folder: pathlib.Path,
35
37
  files_search_root_folder: pathlib.Path,
36
38
  files_search_exclude_folders: typing.List[pathlib.Path],
@@ -47,15 +47,27 @@ def backoff_time(curr_retry):
47
47
  return 2 ** (curr_retry - 1)
48
48
 
49
49
 
50
+ class RetryException(Exception):
51
+ ...
52
+
53
+
50
54
  def retry_request(func):
51
55
  def wrapper(*args, **kwargs):
52
56
  retry = 0
53
57
  while retry < MAX_RETRIES:
54
58
  try:
55
- return func(*args, **kwargs)
59
+ response = func(*args, **kwargs)
60
+ if response.status_code == 502:
61
+ logger.warning(
62
+ "Response status code was 502.",
63
+ extra=dict(extra_log_attributes=dict(retry=retry)),
64
+ )
65
+ raise RetryException
66
+ return response
56
67
  except (
57
68
  requests.exceptions.ConnectionError,
58
69
  requests.exceptions.Timeout,
70
+ RetryException,
59
71
  ) as exp:
60
72
  logger.warning(
61
73
  "Request failed. Retrying",
@@ -38,10 +38,30 @@ def get_versioning_system() -> VersioningSystemInterface:
38
38
  class GitVersioningSystem(VersioningSystemInterface):
39
39
  @classmethod
40
40
  def is_available(cls):
41
- return which("git") is not None
41
+ if which("git") is not None:
42
+ p = subprocess.run(
43
+ ["git", "rev-parse", "--show-toplevel"], capture_output=True
44
+ )
45
+ if p.stdout:
46
+ return True
47
+ return False
42
48
 
43
49
  def get_fallback_value(self, fallback_field: FallbackFieldEnum):
44
50
  if fallback_field == FallbackFieldEnum.commit_sha:
51
+ # here we will get the commit SHA of the latest commit
52
+ # that is NOT a merge commit
53
+ p = subprocess.run(
54
+ # List current commit parent's SHA
55
+ ["git", "rev-parse", "HEAD^@"],
56
+ capture_output=True,
57
+ )
58
+ parents_hash = p.stdout.decode().strip().splitlines()
59
+ if len(parents_hash) == 2:
60
+ # IFF the current commit is a merge commit it will have 2 parents
61
+ # We return the 2nd one - The commit that came from the branch merged into ours
62
+ return parents_hash[1]
63
+ # At this point we know the current commit is not a merge commit
64
+ # so we get it's SHA and return that
45
65
  p = subprocess.run(["git", "log", "-1", "--format=%H"], capture_output=True)
46
66
  if p.stdout:
47
67
  return p.stdout.decode().strip()
@@ -56,7 +76,7 @@ class GitVersioningSystem(VersioningSystemInterface):
56
76
  return branch_name if branch_name != "HEAD" else None
57
77
 
58
78
  if fallback_field == FallbackFieldEnum.slug:
59
- # if there are multiple remotes, we will prioritize using the one called 'origin' if it exsits, else we will use the first one in 'git remote' list
79
+ # if there are multiple remotes, we will prioritize using the one called 'origin' if it exists, else we will use the first one in 'git remote' list
60
80
 
61
81
  p = subprocess.run(["git", "remote"], capture_output=True)
62
82
 
@@ -78,7 +98,7 @@ class GitVersioningSystem(VersioningSystemInterface):
78
98
  return parse_slug(remote_url)
79
99
 
80
100
  if fallback_field == FallbackFieldEnum.git_service:
81
- # if there are multiple remotes, we will prioritize using the one called 'origin' if it exsits, else we will use the first one in 'git remote' list
101
+ # if there are multiple remotes, we will prioritize using the one called 'origin' if it exists, else we will use the first one in 'git remote' list
82
102
 
83
103
  p = subprocess.run(["git", "remote"], capture_output=True)
84
104
  if not p.stdout:
@@ -25,32 +25,34 @@ def do_upload_logic(
25
25
  versioning_system: VersioningSystemInterface,
26
26
  ci_adapter: CIAdapterBase,
27
27
  *,
28
- commit_sha: str,
29
- report_code: str,
28
+ branch: typing.Optional[str],
30
29
  build_code: typing.Optional[str],
31
30
  build_url: typing.Optional[str],
32
- job_code: typing.Optional[str],
31
+ commit_sha: str,
32
+ disable_file_fixes: bool = False,
33
+ disable_search: bool = False,
34
+ dry_run: bool = False,
35
+ enterprise_url: typing.Optional[str],
33
36
  env_vars: typing.Dict[str, str],
37
+ fail_on_error: bool = False,
38
+ files_search_exclude_folders: typing.List[Path],
39
+ files_search_explicitly_listed_files: typing.List[Path],
40
+ files_search_root_folder: Path,
34
41
  flags: typing.List[str],
42
+ git_service: typing.Optional[str],
43
+ handle_no_reports_found: bool = False,
44
+ job_code: typing.Optional[str],
35
45
  name: typing.Optional[str],
46
+ network_filter: typing.Optional[str],
47
+ network_prefix: typing.Optional[str],
36
48
  network_root_folder: Path,
37
- files_search_root_folder: Path,
38
- files_search_exclude_folders: typing.List[Path],
39
- files_search_explicitly_listed_files: typing.List[Path],
40
49
  plugin_names: typing.List[str],
41
- token: str,
42
- branch: typing.Optional[str],
43
- slug: typing.Optional[str],
44
50
  pull_request_number: typing.Optional[str],
51
+ report_code: str,
52
+ slug: typing.Optional[str],
53
+ token: str,
45
54
  upload_file_type: str = "coverage",
46
55
  use_legacy_uploader: bool = False,
47
- fail_on_error: bool = False,
48
- dry_run: bool = False,
49
- git_service: typing.Optional[str],
50
- enterprise_url: typing.Optional[str],
51
- disable_search: bool = False,
52
- handle_no_reports_found: bool = False,
53
- disable_file_fixes: bool = False,
54
56
  ):
55
57
  if upload_file_type == "coverage":
56
58
  preparation_plugins = select_preparation_plugins(cli_config, plugin_names)
@@ -63,7 +65,12 @@ def do_upload_logic(
63
65
  disable_search,
64
66
  upload_file_type,
65
67
  )
66
- network_finder = select_network_finder(versioning_system)
68
+ network_finder = select_network_finder(
69
+ versioning_system,
70
+ network_filter=network_filter,
71
+ network_prefix=network_prefix,
72
+ network_root_folder=network_root_folder,
73
+ )
67
74
  collector = UploadCollector(
68
75
  preparation_plugins, network_finder, file_selector, disable_file_fixes
69
76
  )
@@ -232,7 +232,7 @@ class FileFinder(object):
232
232
  files_excluded_but_user_includes.append(str(file))
233
233
  if files_excluded_but_user_includes:
234
234
  logger.warning(
235
- "Some files being explicitly added are found in the list of excluded files for upload.",
235
+ "Some files being explicitly added are found in the list of excluded files for upload. We are still going to search for the explicitly added files.",
236
236
  extra=dict(
237
237
  extra_log_attributes=dict(files=files_excluded_but_user_includes)
238
238
  ),
@@ -246,7 +246,6 @@ class FileFinder(object):
246
246
  self.search_root,
247
247
  self.folders_to_ignore,
248
248
  filename_include_regex=regex_patterns_to_include,
249
- filename_exclude_regex=regex_patterns_to_exclude,
250
249
  multipart_include_regex=multipart_include_regex,
251
250
  )
252
251
  )
@@ -0,0 +1,43 @@
1
+ import pathlib
2
+ import typing
3
+
4
+ from codecov_cli.helpers.versioning_systems import VersioningSystemInterface
5
+
6
+
7
+ class NetworkFinder(object):
8
+ def __init__(
9
+ self,
10
+ versioning_system: VersioningSystemInterface,
11
+ network_filter: typing.Optional[str],
12
+ network_prefix: typing.Optional[str],
13
+ network_root_folder: pathlib.Path,
14
+ ):
15
+ self.versioning_system = versioning_system
16
+ self.network_filter = network_filter
17
+ self.network_prefix = network_prefix
18
+ self.network_root_folder = network_root_folder
19
+
20
+ def find_files(self, ignore_filters=False) -> typing.List[str]:
21
+ files = self.versioning_system.list_relevant_files(self.network_root_folder)
22
+
23
+ if not ignore_filters:
24
+ if self.network_filter:
25
+ files = [file for file in files if file.startswith(self.network_filter)]
26
+ if self.network_prefix:
27
+ files = [self.network_prefix + file for file in files]
28
+
29
+ return files
30
+
31
+
32
+ def select_network_finder(
33
+ versioning_system: VersioningSystemInterface,
34
+ network_filter: typing.Optional[str],
35
+ network_prefix: typing.Optional[str],
36
+ network_root_folder: pathlib.Path,
37
+ ):
38
+ return NetworkFinder(
39
+ versioning_system,
40
+ network_filter,
41
+ network_prefix,
42
+ network_root_folder,
43
+ )
@@ -36,10 +36,10 @@ class UploadCollector(object):
36
36
  self.file_finder = file_finder
37
37
  self.disable_file_fixes = disable_file_fixes
38
38
 
39
- def _produce_file_fixes_for_network(
40
- self, network: typing.List[str]
39
+ def _produce_file_fixes(
40
+ self, files: typing.List[str]
41
41
  ) -> typing.List[UploadCollectionResultFileFixer]:
42
- if not network or self.disable_file_fixes:
42
+ if not files or self.disable_file_fixes:
43
43
  return []
44
44
  # patterns that we don't need to specify a reason for
45
45
  empty_line_regex = re.compile(r"^\s*$")
@@ -94,7 +94,7 @@ class UploadCollector(object):
94
94
  }
95
95
 
96
96
  result = []
97
- for filename in network:
97
+ for filename in files:
98
98
  for glob, fix_patterns in file_regex_patterns.items():
99
99
  if fnmatch(filename, glob):
100
100
  result.append(self._get_file_fixes(filename, fix_patterns))
@@ -150,21 +150,27 @@ class UploadCollector(object):
150
150
  prep.run_preparation(self)
151
151
  logger.debug("Collecting relevant files")
152
152
  network = self.network_finder.find_files()
153
- files = self.file_finder.find_files()
154
- logger.info(f"Found {len(files)} {report_type} files to upload")
155
- if not files:
153
+ report_files = self.file_finder.find_files()
154
+ logger.info(f"Found {len(report_files)} {report_type} files to report")
155
+ if not report_files:
156
+ if report_type == "test_results":
157
+ error_message = "No JUnit XML reports found. Please review our documentation (https://docs.codecov.com/docs/test-result-ingestion-beta) to generate and upload the file."
158
+ else:
159
+ error_message = "No coverage reports found. Please make sure you're generating reports successfully."
156
160
  raise click.ClickException(
157
161
  click.style(
158
- f"No {report_type} reports found. Please make sure you're generating reports successfully.",
162
+ error_message,
159
163
  fg="red",
160
164
  )
161
165
  )
162
- for file in files:
166
+ for file in report_files:
163
167
  logger.info(f"> {file}")
164
168
  return UploadCollectionResult(
165
169
  network=network,
166
- files=files,
167
- file_fixes=self._produce_file_fixes_for_network(network)
168
- if report_type == "coverage"
169
- else [],
170
+ files=report_files,
171
+ file_fixes=(
172
+ self._produce_file_fixes(self.network_finder.find_files(True))
173
+ if report_type == "coverage"
174
+ else []
175
+ ),
170
176
  )
@@ -51,6 +51,7 @@ class UploadSender(object):
51
51
  "name": name,
52
52
  "job_code": job_code,
53
53
  "version": codecov_cli_version,
54
+ "ci_service": ci_service,
54
55
  }
55
56
 
56
57
  # Data to upload to Codecov
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codecov-cli
3
- Version: 0.4.8
3
+ Version: 0.5.0
4
4
  Summary: Codecov Command Line Interface
5
5
  Author: Codecov
6
6
  Author-email: support@codecov.io
@@ -134,7 +134,7 @@ Codecov-cli supports user input. These inputs, along with their descriptions and
134
134
  | `get-report-results` | Used for local upload. It asks codecov to provide you the report results you calculated with the previous command.
135
135
  | `pr-base-picking` | Tells codecov that you want to explicitly define a base for your PR
136
136
  | `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.
137
- | `send-notification` | 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.
137
+ | `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.
138
138
  >**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.
139
139
 
140
140
 
@@ -10,7 +10,7 @@ with open(path.join(here, "README.md"), encoding="utf-8") as f:
10
10
 
11
11
  setup(
12
12
  name="codecov-cli",
13
- version="0.4.8",
13
+ version="0.5.0",
14
14
  packages=find_packages(exclude=["contrib", "docs", "tests*"]),
15
15
  description="Codecov Command Line Interface",
16
16
  long_description=long_description,
@@ -1,21 +0,0 @@
1
- import pathlib
2
- import typing
3
-
4
- from codecov_cli.helpers.versioning_systems import VersioningSystemInterface
5
-
6
-
7
- class NetworkFinder(object):
8
- def __init__(self, versioning_system: VersioningSystemInterface):
9
- self.versioning_system = versioning_system
10
-
11
- def find_files(
12
- self,
13
- network_root: typing.Optional[pathlib.Path] = None,
14
- network_filter=None,
15
- network_adjuster=None,
16
- ) -> typing.List[str]:
17
- return self.versioning_system.list_relevant_files(network_root)
18
-
19
-
20
- def select_network_finder(versioning_system: VersioningSystemInterface):
21
- return NetworkFinder(versioning_system)
File without changes
File without changes
File without changes