Commit c3b4e4ba authored by Ben Gamari's avatar Ben Gamari 🐢

Improve summary formatting

parent b498cc6a
Pipeline #8073 passed with stages
in 36 minutes and 12 seconds
......@@ -81,8 +81,7 @@ build:
after_script:
- nix run -f '<nixpkgs>' gnutar -c tar -zcf logs.tar.gz logs
# The following throws a fontconfig error but it appears to be innocuous.
- nix run -f '<nixpkgs>' graphviz -c dot -O -T svg summary.dot
- nix run -f '<nixpkgs>' graphviz -c scripts/render-graph.sh summary.dot > summary.dot.svg
- ls -lh
artifacts:
......@@ -116,6 +115,12 @@ update-repo:
- nix-channel --update
- nix build -f scripts/build-repo.nix
- nix run -f scripts/build-repo.nix -c build-repo.sh build-repo
- nix run -f '<nixpkgs>' gnutar -c tar -zxf logs.tar.gz
- mv logs repo
- cp summary.dot.svg repo
dependencies:
- build
after_script:
- rm -Rf keys
......
......@@ -37,10 +37,12 @@ extract_keys_tarball() {
fi
}
build_index_html() {
build_index() {
local keys="$(find keys/root -type f -printf "%f")"
local commit="$CI_COMMIT_SHA"
local commit_url="https://gitlab.haskell.org/ghc/head.hackage/commit/$commit"
local newline=$'\n'
cat | sed -e 's/ \+$//' >repo/cabal.project.local <<EOF
sed -e 's/ \+$//' >repo/cabal.project.local <<EOF
repository head.hackage.ghc.haskell.org
url: https://ghc.gitlab.haskell.org/head.hackage/
secure: True
......@@ -49,6 +51,43 @@ repository head.hackage.ghc.haskell.org
${keys//.private/$newline }
EOF
cat >repo/ci.html <<EOF
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css" />
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css" media="screen">
<script type="text/javascript" src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script src="scripts/imgViewer2.min.js"></script>
<title>head.hackage</title>
</head>
<body>
<section class="container">
<h1 class="title">head.hackage build results</h1>
<p>This page summarizes the build dependency graph from the continuous
integration build of <code>head.hackage</code> commit
<a href="$commit_url"><code>$commit</code></a>.
<img id="graph" width="80%" height="80%" src="summary.dot.svg">
<script>
(function($) {
\$("\#graph").imgViewer2();
})($);
</script>
</body>
</html>
EOF
mkdir -p repo/scripts
curl https://raw.githubusercontent.com/waynegm/imgViewer2/master/dist/imgViewer2.min.js \
> repo/scripts/imgViewer2.min.js
cat >repo/index.html <<EOF
<!DOCTYPE html>
<html>
......@@ -80,6 +119,12 @@ $(cat repo/cabal.project.local)
<a href="https://gitlab.haskell.org/ghc/head.hackage">head.hackage
documentation</a> or
<a href="https://gitlab.haskell.org/ghc/head.hackage/issues">let us know</a>.
<p>You might also be interested in referring to the <a href="ci.html">CI
build results</a> of the build that gave rise to this repository.
<p><code>head.hackage</code> commit:
<a href="$commit_url"><code>$commit</code></a>
</section>
</body>
</html>
......@@ -108,13 +153,14 @@ build_repo() {
--template=template \
./repo
build_index_html
build_index
}
case $1 in
gen-keys) gen_keys_tarball ;;
extract-keys) extract_keys_tarball ;;
build-repo) build_repo ;;
build-index) build_index ;;
*)
echo "Unknown command $1"
exit 1
......
#!/bin/sh
# The following throws a fontconfig error but it appears to be innocuous.
unflatten -f -l 3 \
| dot \
| neato -s -n2 -Tsvg -Gsize="40,10" -Gratio="fill" -Gsplines=true
#unflatten -f -l 2 | dot | sfdp -s -n2 -Tsvg -o output.svg -Gsize="24,12" -Gratio="fill" -Goverlap="false"
......@@ -55,8 +55,12 @@ def export_dot(summary):
s += f' "{pkg}" -> "{dep}";\n'
for pkg in summary['pkgs']:
color = 'lightblue'
if pkg['failed']:
s += f' "{pkg["drvName"]}" [ color=indianred style=filled ];\n'
color = 'indianred'
elif pkg['drvName'] in summary['roots']:
color = 'green'
s += f' "{pkg["drvName"]}" [ URL="logs/{pkg["drvName"]}.log" color={color} style=filled ];\n'
s += '}'
return s
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment