using Coverage
const report_dir = "coverage_report"
const lcov_info_file = "lcov.info"
cd(joinpath(@__DIR__, "..", "..")) do
processed = process_folder("src")
covered_lines, total_lines = get_summary(processed)
percentage = covered_lines / total_lines * 100
println("($(percentage)%) covered")
isdir(report_dir) || mkdir(report_dir)
tracefile = joinpath(report_dir, lcov_info_file)
Coverage.LCOV.writefile(tracefile, processed)
branch = strip(read(`git rev-parse --abbrev-ref HEAD`, String))
commit = strip(read(`git rev-parse --short HEAD`, String))
title = "commit $(commit) on branch $(branch)"
run(`genhtml -t $(title) -o $(report_dir) $(tracefile)`)
clean_folder("src")
end