tkf / BenchmarkCI.jl

Compare bee95d5 ... +0 ... 7838420

Coverage Reach
BenchmarkCI.jl gitutils.jl runtimeinfo.jl

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 1 files from the diff.

@@ -62,6 +62,18 @@
Loading
62 62
    return d
63 63
end
64 64
65 +
function setnested!(d0, v, keys...)
66 +
    d = d0
67 +
    for k in keys[1:end-1]
68 +
        d = get!(d, k, empty(d0))
69 +
    end
70 +
    d[keys[end]] = v
71 +
    return d
72 +
end
73 +
74 +
mirrornested!(dest, src, keys...) =
75 +
    setnested!(dest, getnested(src, keys...), keys...)
76 +
65 77
is_in_ci(ENV = ENV) =
66 78
    lowercase(get(ENV, "CI", "false")) == "true" || haskey(ENV, "GITHUB_EVENT_PATH")
67 79
@@ -508,13 +520,10 @@
Loading
508 520
509 521
struct GitHubCommitInfo
510 522
    repo_url::Union{Nothing,String}
511 -
    pull_request_commit_sha::Union{Nothing,String}
512 -
    pull_request_url::Union{Nothing,String}
513 -
    pull_request_title::Union{Nothing,String}
523 +
    pull_request::Dict{String,Any}
514 524
end
515 525
516 -
GitHubCommitInfo() =
517 -
    GitHubCommitInfo(nothing, nothing, nothing, nothing)
526 +
GitHubCommitInfo() = GitHubCommitInfo(nothing, Dict{String,Any})
518 527
519 528
function github_commit_info()
520 529
    commit_info::GitHubCommitInfo = GitHubCommitInfo()
@@ -523,11 +532,22 @@
Loading
523 532
    event_path === nothing && return commit_info
524 533
    event = JSON.parsefile(event_path)
525 534
535 +
    # https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request
526 536
    if get(ENV, "GITHUB_EVENT_NAME", nothing) == "pull_request"
527 -
        @set! commit_info.pull_request_url = getnested(event, "pull_request", "html_url")
528 -
        @set! commit_info.pull_request_title = getnested(event, "pull_request", "title")
529 -
        @set! commit_info.pull_request_commit_sha =
530 -
            getnested(event, "pull_request", "head", "sha")
537 +
        if (pull_request = get(event, "pull_request", nothing)) !== nothing
538 +
            for keys in Tuple[
539 +
                ("html_url",),
540 +
                ("title",),
541 +
                ("user", "login"),
542 +
                ("head", "sha"),
543 +
                ("head", "ref"),
544 +
                ("head", "repo", "html_url"),
545 +
                ("base", "sha"),
546 +
                ("base", "ref"),
547 +
            ]
548 +
                mirrornested!(commit_info.pull_request, pull_request, keys...)
549 +
            end
550 +
        end
531 551
    end
532 552
533 553
    @set! commit_info.repo_url = getnested(event, "repository", "html_url")
@@ -536,11 +556,16 @@
Loading
536 556
end
537 557
538 558
function printinfomd(io, commit_info::GitHubCommitInfo)
539 -
    @unpack repo_url, pull_request_commit_sha, pull_request_url, pull_request_title =
540 -
        commit_info
559 +
    @unpack repo_url, pull_request = commit_info
560 +
    pull_request_url = getnested(pull_request, "html_url")
561 +
    pull_request_title = getnested(pull_request, "title")
562 +
    pull_request_commit_sha = getnested(pull_request, "head", "ref")
563 +
    target_commit_url = nothing
564 +
541 565
    if repo_url !== nothing && pull_request_commit_sha !== nothing
542 566
        target_commit_url = "$repo_url/commit/$pull_request_commit_sha"
543 567
    end
568 +
544 569
    if target_commit_url !== nothing
545 570
        println(
546 571
            io,

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
src -2.19% 60.63%
Project Totals (3 files) 60.63%
Loading