Skip to content

Commit

Permalink
Report package history in PkgEval summaries (continued) (#172)
Browse files Browse the repository at this point in the history
Co-authored-by: Lilith Hafner <[email protected]>
Co-authored-by: Tim Besard <[email protected]>
  • Loading branch information
3 people authored Aug 4, 2023
1 parent 0c03c41 commit 4d82131
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/jobs/PkgEvalJob.jl
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ function report(job::PkgEvalJob, results)
if cfg.bucket !== nothing
reportname = "report.html"
parser = Parser()
enable!(parser, TableRule())
ast = parser(report_md)
body = html(ast)
report_html = """
Expand Down Expand Up @@ -835,7 +836,7 @@ function get_history(cfg, days = 30)

# Determine the date of the last upload
format = dateformat"yyyy-mm/dd"
latest = read(joinpath(dir, "latest"), String)
latest = readlink(joinpath(dir, "latest"))
end_date = parse(Date, latest, format)
start_date = end_date - Day(days-1)

Expand All @@ -844,7 +845,7 @@ function get_history(cfg, days = 30)
@sync for (i, date) in enumerate(start_date:Day(1):end_date)
date_str = Dates.format(date, format)
@async try
content[i] = read(joinpath(dir, date_str, db.json))
content[i] = read(joinpath(dir, date_str, "db.json"))
catch _
@warn "Failed to fetch data for $date_str"
content[i] = Vector{UInt8}[]
Expand Down Expand Up @@ -1115,6 +1116,14 @@ function printreport(io::IO, job::PkgEvalJob, results)
println(io)
end

function reportsubgroup(subgroup)
five_col = any(row->row.source == "both", eachrow(subgroup))
println(io, five_col ? "| Package | Version | Primary | Against | $history_heading |" : "| Package | $history_heading |")
println(io, five_col ? "| ------- | ------- | ------- | ------- | ------- |" : "| ------- | ------- |")
foreach(reportrow, eachrow(subgroup))
println(io)
end

# report on a group of tests, prefixed with the reason
function reportgroup(group)
subgroups = groupby(group, :reason; skipmissing=true)
Expand All @@ -1125,10 +1134,7 @@ function printreport(io::IO, job::PkgEvalJob, results)
<p>
""")
println(io)
println(io, hasagainstbuild ? "| Package | Version | Primary | Against | $history_heading |" : "| Package | $history_heading |")
println(io, hasagainstbuild ? "| ------- | ------- | ------- | ------- | ------- |" : "| ------- | ------- |")
foreach(reportrow, eachrow(subgroup))
println(io)
reportsubgroup(subgroup)
println(io, """
</p>
</details>
Expand All @@ -1142,10 +1148,7 @@ function printreport(io::IO, job::PkgEvalJob, results)
println(io, "Other:")
println(io)
end
println(io, hasagainstbuild ? "| Package | Version | Primary | Against | $history_heading |" : "| Package | $history_heading |")
println(io, hasagainstbuild ? "| ------- | ------- | ------- | ------- | ------- |" : "| ------- | ------- |")
foreach(reportrow, eachrow(subgroup))
println(io)
reportsubgroup(subgroup)
end
end

Expand Down

0 comments on commit 4d82131

Please sign in to comment.