clone

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

Cover the CI gate, site previews and backups with scenarios

cat committed f97fd98
forge.requireci turns away a tree without a verified pass and takes one
with it; a review branch's preview is served and goes away with the
branch, and gc frees its files; a staged backup restores into an empty
root with hooks, keys, refs, review logs and comments intact.
commit
f97fd9844137ebdb7d4126e3cbe528c33da004df
parent
9ca2d2565203f3b066d1fed0f50662b3bc360c9f
author
cat <admin@dev.site>
kind
test risk score 0.1 of 3, Jev's estimate
3 files changed, +75 -0
Atest/scenarios/backup-restore.sh23++++++++++++++++++++++
Atest/scenarios/ci-gate.sh20+++++++++++++++++++
Atest/scenarios/site-preview.sh32++++++++++++++++++++++++++++++
A test/scenarios/backup-restore.sh +23 -0
A test/scenarios/ci-gate.sh +20 -0
A test/scenarios/site-preview.sh +32 -0
@@ -0,0 +1,32 @@
1+# A site deploy is a ref whose tree is served; a branch gets a preview,2+# which goes away with the branch. Only the owner deploys refs/sites.3+. "$(dirname "$0")/../lib.sh"4+user dami5+user ana6+repo dami/greet7+clone dami dami/greet "$T/w/d"8+at "$T/w/d" commit "first"9+push_as dami "$T/w/d" origin main10+export FORGE_USER=dami11+mkdir -p "$T/site" && printf '<h1>docs v1</h1>\n' >"$T/site/index.html"12+ok at "$T/w/d" "$FORGE" site push "$T/site" docs13+has "$FORGE_WWW/sites/dami/greet/docs/index.html" 'docs v1'14+15+clone ana dami/greet "$T/w/a"16+at "$T/w/a" git switch -q -c ana/tweak17+at "$T/w/a" commit "tweak"18+push_as ana "$T/w/a" origin ana/tweak19+printf '<h1>docs v2</h1>\n' >"$T/site/index.html"20+FORGE_USER=ana ok at "$T/w/a" "$FORGE" site push "$T/site" docs21+has "$FORGE_WWW/previews/dami/greet/docs/ana~tweak/index.html" 'docs v2'22+has "$FORGE_WWW/sites/dami/greet/docs/index.html" 'docs v1'23+at "$T/w/a" git update-ref refs/sites/docs "$(git -C "$T/w/a" rev-parse refs/site-previews/docs/ana/tweak)"24+fails_with "only dami can update this" push_as ana "$T/w/a" origin +refs/sites/docs25+26+ok push_as ana "$T/w/a" origin :ana/tweak27+missing "$FORGE_WWW/previews/dami/greet/docs/ana~tweak"28+fails git --git-dir="$FORGE_ROOT/dami/greet.git" rev-parse -q --verify refs/site-previews/docs/ana/tweak29+# gc frees the preview's files and keeps the live site's.30+ok forge gc --age 031+output | grep -q '^removed store' || fail "gc removed no store tree"32+has "$FORGE_WWW/sites/dami/greet/docs/index.html" 'docs v1'