clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / insights-pages.sh
insights-pages.sh 2.2K
1# Insights pages: the forge's at /insights/ and each repo's at2# /<owner>/<repo>/insights/, static pages whose charts fetch insights.json,3# with the rows as Parquet next to it. forge lake writes the exports into4# the live pages; builds keep them.5. "$(dirname "$0")/../lib.sh"6user dami7user ana8repo dami/greet9clone dami dami/greet "$T/w/d"10at "$T/w/d" commit "first"11push_as dami "$T/w/d" origin main12clone ana dami/greet "$T/w/a"13at "$T/w/a" commit "idea"14push_as ana "$T/w/a" origin HEAD:ana/idea15build16w=$FORGE_WWW17has "$w/dami/greet/insights/index.html" 'data-insights="/dami/greet/insights/insights.json"'18has "$w/dami/greet/insights/index.html" '<script src="/assets/insights\.[A-Za-z0-9_-]{10}\.js" defer>'19has "$w/dami/greet/index.html" '<a href="/dami/greet/insights/" data-key="i">insights</a>'20has "$w/insights/index.html" 'data-insights="/insights/insights.json" data-forge="1"'21has "$w/index.html" '<span class="end"><a href="/insights/">insights</a></span>'22# The charts' script is only on insights pages.23lacks "$w/dami/greet/index.html" 'assets/insights\.'24# No lake yet: no data, and the page says so when it can't fetch it.25missing "$w/insights/insights.json"26ok forge lake27has "$T_LOG" 'exported 2 scopes, published 2 scopes'28for d in "$w/insights" "$w/dami/greet/insights"; do29 for f in events builds reviews ci; do30 [ "$(head -c 4 "$d/$f.parquet")" = PAR1 ] || fail "$d/$f.parquet isn't Parquet"31 done32done33has "$w/dami/greet/insights/insights.json" '"scope":"dami/greet"'34has "$w/dami/greet/insights/insights.json" '"pushes":2,"builds":1,'35has "$w/insights/insights.json" '"scope":"forge"'36has "$w/insights/insights.json" '"repos":\[\["dami/greet",2,'37# A push and a run of the lake update the live exports without a build.38at "$T/w/d" commit "second"39push_as dami "$T/w/d" origin main40ok forge lake41has "$w/dami/greet/insights/insights.json" '"pushes":3,'42# A build of the repo swaps its pages, and keeps the exports; a full build43# keeps the forge's.44build dami/greet45has "$w/dami/greet/insights/insights.json" '"pushes":3,'46build47has "$w/insights/insights.json" '"pushes":3,'48exists "$w/dami/greet/insights/ci.parquet"49# insights can't be an owner: the forge's page lives there.50fails_with "invalid|not a valid|can't" forge repo new insights/x