-
Notifications
You must be signed in to change notification settings - Fork 16
/
codecov.saas.txt
572 lines (449 loc) · 29.4 KB
/
codecov.saas.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
CODECOV
ALTERNATIVES ==> # - istanbul HTML reporter
# - codecov (prefered):
# - more than just LCOV
# - good CI integration
# - REST API
# - badges
# - notifications
# - PR comments
# - GitHub status
# - config validation
# - "flags"
# - free for public repos
# - coveralls
# - seems like not so much maintained anymore and losing traction
# - LCOV-only
# - good CI integration
# - REST API
# - badges
# - notifications
# - PR comments
# - GitHub status (PR only)
# - free for public repos
GOAL ==> #SaaS online code coverage reporting.
CODECOV ENTERPRISE ==> #On-premise
/=+===============================+=\
/ : : \
)==: CLI :==(
\ :_______________________________: /
\=+===============================+=/
covecovcli #Binary. Installed with pip or GitHub release
#Version 0.5.2
https://cli.codecov.io #URL to OS-specific binary
/OS/VERSION/codecov #OS is linux[-arm64]|macos|windows|alpine[-arm64]
#NODE_VERSION is latest|vX.Y.Z
with.version #'X.Y.Z' of codecovcli or 'latest' (def)
with.os #OS for codecovcli (def: uses ENVVAR RUNNER_OS, or 'linux')
codecov/codecov-action #Calls codecovcli: create-commit -> create-report -> do-upload
#Downloads codecovcli at https://cli.codecov.io/
#Version 4.3.1
with.working_directory #Current 'DIR' when running codecovcli (def: '.')
with.disable_safe_directory #BOOL. If false (def), set git CONFVAR.safe.directory ENVVAR GITHUB_WORKSPACE
#I.e. allow files to be owned by a different OS user
/=+===============================+=\
/ : : \
)==: CONFIG :==(
\ :_______________________________: /
\=+===============================+=/
CONF #Either:
# - all repositories: in web UI
# - repository-specific: ROOT/[dev|.github/][**/][.]codecov.yml
--codecov-yml-path CONF_PATH
with.codecov_yml_path #
curl --data-binary @CONF_PATH #Validate CONF. Automatically done in web UI.
https://codecov.io/validate #There is also a VSCode extension
CONFIDENTIAL VALUES ==> #Can encrypt them using server-side key from web UI (Settings > YAML)
#then use "secret:ENCRYPTED" in CONF
ENVVAR CODECOV_TOKEN
CONF.codecov.token
--token|-t ACCESS_TOKEN
with.token #Can use either a global one, or repository-specific one
with.use_oidc #Use GitHub's OIDC instead of using tokens
#Should set JOB.permissions.id-token 'write'
ENVVAR CODECOV_FLAGS #Alternate way to set CLI flags
/=+===============================+=\
/ : : \
)==: UPLOADING :==(
\ :_______________________________: /
\=+===============================+=/
CODE COVERAGE UPLOAD ==> #Supports many code coverage formats, including LCOV
#However should prefer c8 'json' reporter output (coverage.json)
#Can upload several at times, e.g. through single API request or through running several
#times in single CI job
#Uploads following information:
# - repository token, slug
# - Git commit, branch, PR, tag
# - CI build, job, URL, name
# - FLAGs
# - upload name
# - CONF path
# - which ENVVARs to show
codecovcli upload-process #Upload coverage files
#Same as create-commit -> create-report -> do-upload
codecovcli create-commit #Upload git metadata to current commit to Codecov
codecovcli create-report #Initialize new results on Codecov
codecovcli do-upload #Upload local coverage files
codecovcli create-report-results #Create Codecov results, once done uploading
codecovcli get-report-results #Retrieve Codecov results, to show locally
codecovcli empty-upload #Make Codecov pass, providing no test coverage changed
--force #
--dry-run|-d
with.dry_run #Don't upload files
codecovcli
--verbose|-v
with.verbose #Verbose logging
CONF.codecov.max_report_age #'DURATION' (def: '12h') or NUM|BOOL. Timeout for results creation
CONF.codecov.archive.uploads #BOOL (def: true). Save reports in Codecov UI
/=+===============================+=\
/ : : \
)==: CI :==(
\ :_______________________________: /
\=+===============================+=/
CI ==> #Automatically use CI ENVVARs to fill in:
# - repository token, slug
# - CI build, job, name
# - Git commit, branch, PR, tag
# - which ENVVARs to show
codecovcli create-commit
|create-report[-results]
|do-upload|empty-upload
|get-report-results
|send-notifications
|upload-process
--git-service 'CI'
with.git_service #Among github, gitlab, bitbucket, github_enterprise, gitlab_enterprise, bitbucket_server (def: guessed)
--auto-load-params-from 'CI' #Among Local, CircleCI, GithubActions, GitlabCI, Bitbucket, Bitrise, AppVeyor, Woodpecker, Heroku, DroneCI,
#BuildKite, AzurePipelines, Jenkins, CirrusCI, Teamcity, Travis, AWSCodeBuild (def: guessed)
CONF.codecov.ci #'DOMAIN'_ARR for non-supported CI providers
MERGING SEVERAL CI JOBS ==> #Can be run across several CI jobs: codecov polls CI until done, then merges reports.
SNOTIFY.countdown #NUM (def: null). Wait NUM secs before starting polling
SNOTIFY.delay #NUM (def: 60). Polling frequency in secs
/=+===============================+=\
/ : : \
)==: FILE SELECTION :==(
\ :_______________________________: /
\=+===============================+=/
codecovcli
do-upload|upload-process
--[coverage-]files-search
-direct-file|--file|-f FILE
with.file FILE
with.files FILE,... #Code coverage file[s]
--disable-search
with.disable_search #Unless set, FILEs from --file are added the ones automatically found
--[coverage-]files-search
-root-folder|--dir|-s DIR
with.directory #Def: '.'. Searches for code coverage files in DIR. Project root always included
--[coverage-]files-search
-exclude-folder|--exclude DIR
with.exclude #Exclude those DIR to find code coverage files
--handle-no-reports-found
with.handle_no_reports_found #Fails if no coverage files
CONF.paths #'REGEXP|GLOB'_ARR of covered files to include. Can use **
CONF.fixes #'BEFORE::AFTER'_ARR that transforms:
# - file paths in code coverage file (i.e. build) (BEFORE)
# - to file paths in covered files (i.e. sources) (AFTER)
#So that source files are shown correctly
#BEFORE can be empty (i.e. "any"). AFTER can be empty.
#Can use globbing
CONF.codecov #BOOL. If false (def), add default values to CONF.fixes, including:
.disable_default_path_fixes # - remove user names from file paths
# - ignore node_modules
--network-root-folder DIR
with.root_dir #Def: '.'. Root project (def: Git root)
--network-prefix 'DIR'
with.network_prefix #Prefix to files. Seems involved with CONF.fixes, but not sure how it works
--network-filter 'GLOB'
with.network_filter #'GLOB'. Seems involved with CONF.fixes, but not sure how it works
--report-type TYPE #The type of the file to upload
#Can be coverage (def) or 'test_results'
--plugin STR
with.plugin #
/=+===============================+=\
/ : : \
)==: COMPONENTS :==(
\ :_______________________________: /
\=+===============================+=/
CONF.component_management #SCOMP. Split report and PR comment into sections for different sets of files
#Can also split PR commit STATUS
SCOMP.default_rules #Default COMP
SCOMP.individual_components #COMP_ARR. Each section
COMP.component_id #STR. Identifier
COMP.name #STR. Shown in UI
COMP.paths #'REGEXP|GLOB'_ARR selecting files
/=+===============================+=\
/ : : \
)==: FLAGS :==(
\ :_______________________________: /
\=+===============================+=/
CONF.flags_management #SFLAG
SFLAG.default_rules #Default FLAGCONF
SFLAG.individual_flags #FLAGCONF_ARR. List of flags, and their associated config
FLAGCONF.name #'FLAG'
CONF.flags.FLAG #PFLAG. Alternative to SFLAG. Usually not preferred
PFLAG|FLAGCONF.paths #'GLOB'_ARR (def: any file). Can use **
PFLAG.branches #LBRANCH_ARR
PFLAG|FLAGCONF.carryforward #BOOL (def: false). Files that are not run at all keep previous coverage rate, as opposed to being 0%
PFLAG.joined #BOOL. If false (def: true), reports are available individually, but not to the main report
#For example, useful for betas, nightly builds, etc.
codecovcli
do-upload|upload-process
--flag|-F 'FLAG,...' #Tag report with a specific "flag". Used in UI as filters.
with.flags #E.g. different environment, type of testing, etc.
#FLAG must be only a-zA-Z0-9_-., max 45 chars
COMP.flag_regexes #'REGEXP' (def: all). Only use those flags with this COMP
/=+===============================+=\
/ : : \
)==: COVERAGE LOGIC :==(
\ :_______________________________: /
\=+===============================+=/
CONF.coverage #SCOVERAGE
SCOVERAGE.precision #NUM (def: 2). Rounding precision for coverage percentage
SCOVERAGE.round #'down' (def), 'up' or 'nearest'. Rounding for coverage percentage.
SCOVERAGE.range #[NUM, NUM2] (def: [70, 100]). Range of red..green colors.
SCOVERAGE.parsers #PARSERS
PARSERS.javascript.enable_partials#BOOL (def: false). Branch-level instead of only line-level coverage.
#Only works with JSON reporter, not LCOV
#Not with TypeScript
PARSERS.go #GO
GO.partials_as_hits #BOOL (def: false). Consider partial lines hits, not misses
PARSERS.gcov.branch_detection #gcov. BRANCH_DETECTION
BRANCH_DETECTION.conditional #BOOL (def: true)
BRANCH_DETECTION.loop #BOOL (def: true)
BRANCH_DETECTION.method #BOOL (def: false)
BRANCH_DETECTION.macro #BOOL (def: false)
PARSERS.jacoco #Java
PARSERS.cobertura #Java
PARSERS.v1 #Ruby
codecovcli
do-upload|upload-process
--disable-file-fixes
with.disable_file_fixes #Unless set, ignore common lines like blank lines and empty brackets
DIFF/COMPARE ==> #Available in web UI
CHROME|FIREXO EXTENSION ==> #Allows seeing code coverage from GitHub PR
/=+===============================+=\
/ : : \
)==: METADATA :==(
\ :_______________________________: /
\=+===============================+=/
codecovcli create-report[-results]
|get-report-results
--code NAME
codecovcli
do-upload|upload-process
--report-code NAME #Environment name, to avoid nameconflict with other environment
with.report_code #E.g. 'local-report'
ENVVAR CODECOV_NAME
codecovcli
do-upload|upload-process
--name|-n STR
with.name #Upload name
ENVVAR CODECOV_ENV
codecovcli
do-upload|upload-process
--env[-var]|-e ENVVAR,...
with.env_vars #Show these ENVVARs in web UI
/=+===============================+=\
/ : : \
)==: GIT :==(
\ :_______________________________: /
\=+===============================+=/
codecovcli create-commit
|create-report|do-upload
|upload-process
--pull-request-number|--pr|-P
PR_NUM
with.override_pr #Def: guessed if in a PR
CONF.codecov.branch #Default LBRANCH shown in UI (def: guessed)
CONF.codecov.strict_yaml_branch #LBRANCH of the CONF to use (def: current LBRANCH)
codecovcli create-commit|do-upload
|upload-process
--branch|-B LBRANCH
with.override_branch #LBRANCH used for the report
codecovcli create-commit
|create-report[-results]
|do-upload|empty-upload
|get-report-results
|send-notifications
|static-analysis|upload-process
--[commit-]sha|-C SHA
with.override_commit #Git commit SHA (40 chars) (def: guessed if in a PR)
codecovcli create-commit
|upload-process
--parent-sha SHA
with.commit_parent #Git parent commit SHA (40 chars) (def: guessed)
CONF.codecov.allow_pseudo_compare #BOOL. If true (def), and does not find PR's parent commit for sure, try to guess one
codecovcli
do-upload|upload-process
--job-code CI_JOB_NUM
with.job_code #
--build[-code]|-b CI_BUILD_NUM
with.override_build #
--build-url CI_BUILD_URL
with.override_build_url #
codecovcli create-commit
|create-report[-results]
|do-upload|empty-upload
|get-report-results
|pr-base-picking
|send-notifications
|upload-process
--slug|-r 'USER/REPO'
with.slug #Enterprise only
codecovcli pr-base-picking #Set base commit for the PR
--pr PR_NUM #
--base-sha SHA #Commit SHA (40 chars)
--service STR #E.g. github, etc.
/=+===============================+=\
/ : : \
)==: NOTIFICATIONS :==(
\ :_______________________________: /
\=+===============================+=/
codecovcli create-commit
|create-report[-results]
|do-upload|empty-upload
|get-report-results
|send-notifications
|upload-process
--fail-on-error|-Z
with.fail_ci_if_error #Exit code 1 if failure
CONF.codecov.notify #SNOTIFY
CONF.codecov.require_ci_to_pass
SNOTIFY.wait_for_ci #BOOL (def: true). Do not notify if CI failed, i.e. other unrelated statuses failed
SNOTIFY|FLAGCONF.after_n_builds #NUM. Wait for NUM builds before notifying.
SNOTIFY.manual_trigger #BOOL (def: false). Only notify when manually doing it with codecovcli send-notifications
codecovcli send-notifications #
SCOVERAGE.notify #NOTIFY
NOTIFY.TYPE.NAME #TYPE_NOTIFY
TYPE_NOTIFY.threshold #0-100 (def: any), min decrease|increase to notify
TYPE_NOTIFY.message #STR (def: "Coverage {{changed}} for {{owner}}/{{repo}}")
TYPE_NOTIFY.only_pulls #BOOL (def: false). Only for PRs
TYPE_NOTIFY.branches #LBRANCH[_REGEXP][_ARR] (def: '*')
TYPE_NOTIFY.flags #Only on following 'FLAG'[_ARR]
TYPE_NOTIFY.paths #Whitelists|blacklists 'REGEXP'_ARR of covered files
TYPE_NOTIFY.layout #'PART,...' (def: 'reach, diff') to show in comment:
# - reach: graph
# - diff: text diff
# - flags: flags differences
# - files|tree: files differences
# - components: COMP
# - header, footer
# - condensed_header|footer|file: same but shorter
# - betaprofiling: highlight when an entrypoint file has changed
WEBHOOKS_NOTIFY.url #HTTP POST
GITTER_NOTIFY.url #'URL'
SLACK_NOTIFY.url #'URL'
EMAIL_NOTIFY.to #'EMAIL_ADDRESS'[_ARR]. Does not seem to work.
NOTIFY.irc|hipchat #Others
/=+===============================+=\
/ : : \
)==: PR COMMENTS :==(
\ :_______________________________: /
\=+===============================+=/
CONF.comment #SCOMMENT. PR comments
SCOMMENT false #Disable PR comments (def: true)
SCOMMENT.behavior #STR:
# - default (def): updates single comment, recreates it if deleted
# - once: updates single comment
# - new: recreates new comment always
# - spammy: new comment each time
SCOMMENT.require_changes #BOOL (def: false). Only update PR comment when coverage changes
SCOMMENT.require_base #BOOL (def: false). Only if there is a base commit
SCOMMENT.require_head #BOOL (def: true). Only if there is a previous report
SCOMMENT.branches|layout #Like TYPE_NOTIFY.*
SCOMMENT.hide_project_coverage #BOOL. If false (def), show coverage of whole source, not only of changed files
SCOMMENT.show_carryforward_flags #BOOL (def: false). Show carryforward flags
SCOMMENT.show_critical_paths #BOOL (def: false). Highlight changes to critical logic paths, i.e. lines that were run often during production
#Must send OpenTelemetry information to Codecov
# - In Node: @codecov/node-codecov-opentelemetry module
# - Not fully documented yet
#Authenticate with "Impact analysis" token from UI
CONF.github_checks false #Disable GitHub checks
CONF.github_checks.annotations #BOOL (def: true). Annotate PR with lost coverage
TEAM BOT ==> #Alternative to using the GitHub integration (preferred) for PR comments.
#GitHub user created for sole purpose of this
CONF.codecov.bot #The GitHub user name
/=+===============================+=\
/ : : \
)==: COMMIT STATUS :==(
\ :_______________________________: /
\=+===============================+=/
SCOVERAGE.status #STATUS. Commit status, i.e. block PR from merging
STATUS.TYPE #TYPE_STATUS. TYPE can be:
# - project: whole code
# - patch: only lines updated by PR|commit
# - changes: only lines not updated by PR|commit
#By default project|patch are enabled, changes is not
TYPE_STATUS.NAME #STATUS_SETTINGS
#Each STATUS_SETTINGS shows a different PR status
STATUS.default_rules #Default STATUS_SETTINGS, but can only set flag_coverage_not_uploaded_behavior
TYPE_STATUS.default #Default STATUS_SETTINGS
STATUS_SETTINGS false #Disables
STATUS_SETTINGS.target #'NUM%' to use as a base coverage.
#Def: 'auto', i.e. use base commit
STATUS_SETTINGS.threshold #Minimum 'NUM%' decrease (def: 0) to allow from base coverage
STATUS_SETTINGS.if_no_uploads #'error' (def) or 'success'
STATUS_SETTINGS.if_not_found #'error' or 'success' (def)
STATUS_SETTINGS.if_ci_failed #'error' (def) or 'success'
STATUS_SETTINGS.
only_pulls|paths|branches|flags #Like TYPE_NOTIFY.*
STATUS_SETTINGS.flag_coverage_not #'include' (def), 'exclude', 'pass'
_uploaded_behavior #Make STATUS_SETTINGS flag-specific
STATUS_SETTINGS.informational #BOOL. If false (def), set PR status, i.e. blocks merging PR
STATUS_SETTINGS #Special behavior when removing code:
.removed_code_behavior # - 'off': normal percentage, as is
# - 'adjust_base' (def): ignores removed lines from percentage
# - 'removals_only': do not fail if no code was added
# - 'fully_covered_patch': only consider newly added code
#Only if TYPE is 'project', and STATUS_SETTINGS.target 'auto'
FLAGCONF|COMP.statuses #STATUS_SETTINGS_ARR. Like STATUS, but for specific flags|files instead.
#Each STATUS_SETTINGS must have a different STATUS.type 'TYPE'
#No STATUS_SETTINGS.flags
/=+===============================+=\
/ : : \
)==: BUNDLES :==(
\ :_______________________________: /
\=+===============================+=/
BUNDLE ==> #Support bundling files, as if they were not bundled.
#E.g. show them in files explorer in UI, or in PR comments, etc.
#JavaScript only
#Must use Codecov Node module specific to each bundler
/=+===============================+=\
/ : : \
)==: AUTOMATED TEST SELECTION :==(
\ :_______________________________: /
\=+===============================+=/
AUTOMATED TEST SELECTION ==> #Use test coverage info to speed test automated tests, by only running tests needed for the files changed by current commit
#Not documented yet, because Python only right now
codecovcli static-analysis #Source code static analysis, used by automated test selection
codecovcli label-analysis #Also used by automated test selection
/=+===============================+=\
/ : : \
)==: REST API :==(
\ :_______________________________: /
\=+===============================+=/
REST API ==> #https://codecov.io/api/gh/USER/REPO
#Authorization:
# - ?access_token=ACCESS_TOKEN
#Resources:
# - Teams
# - Users
# - Repositories:
# - Branches|PR
# - Commits
# - Code coverage upload
# - SVG graphs
/=+===============================+=\
/ : : \
)==: BADGES :==(
\ :_______________________________: /
\=+===============================+=/
BADGES ==> #Either:
# - https://codecov.io/gh/USER/REPO[/branch/LBRANCH]/graph/badge.svg?token=STR (generated from UI)
# - https://img.shields.io/covecov/c/github/USER/REPO[/LBRANCH].svg
#Should link to https://codecov.io/gh/USER/REPO[branch/LBRANCH]
SVG GRAPHS ==> #For sunburst, grid or flamegraph
#Can get public URLs from web UI or REST API