aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xaux/ci/ci-build.sh17
-rwxr-xr-xaux/ci/git-post-receive.sh9
-rwxr-xr-xaux/ci/git-pre-push.sh5
-rwxr-xr-xaux/ci/report.sh11
-rwxr-xr-xaux/lib.sh30
-rwxr-xr-xaux/workflow/TODOs.sh34
-rwxr-xr-xaux/workflow/assert-changelog.sh2
-rwxr-xr-xaux/workflow/assert-readme.sh12
-rwxr-xr-xaux/workflow/assert-todos.sh4
-rwxr-xr-xaux/workflow/commonmark.sh45
-rwxr-xr-xaux/workflow/dist.sh2
-rw-r--r--aux/workflow/preamble.md4
-rwxr-xr-xaux/workflow/public.sh35
-rwxr-xr-xaux/workflow/sign-tarballs.sh6
-rw-r--r--aux/workflow/style.css83
15 files changed, 159 insertions, 140 deletions
diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh
index be97866..17e9e37 100755
--- a/aux/ci/ci-build.sh
+++ b/aux/ci/ci-build.sh
@@ -3,10 +3,17 @@ set -eux
PROJECT="$1"
LOGS_DIR="$2"
-read -r _ SHA _ # oldrev newrev refname
+SHA="$3"
FILENAME="$(date -Is)-$SHA.log"
LOGFILE="$LOGS_DIR/$FILENAME"
+mkdtemp() {
+ name="$(echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname.")"
+ rm -f "$name"
+ mkdir "$name"
+ echo "$name"
+}
+
{
echo "Starting CI job at: $(date -Is)"
@@ -26,24 +33,24 @@ EOF
git notes append -m "$NOTE"
cd -
+ git fetch origin refs/notes/*:refs/notes/*
sh aux/ci/report.sh -n "$PROJECT" -o public
rsync -av public/ "/srv/http/$PROJECT/" --delete
- printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS"
+ printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s\n\n" "$STATUS"
}
trap finish EXIT
unset GIT_DIR
REMOTE="$PWD"
- cd "$(mktemp -d)"
+ cd "$(mkdtemp)"
git clone "$REMOTE" .
git config --global user.email git@euandre.org
git config --global user.name 'EuAndreh CI'
- git fetch origin refs/notes/*:refs/notes/*
git annex get ||:
if [ -f aux/guix/with-container.sh ]; then
- RUNNER='./aux/guix/with-container.sh'
+ RUNNER='sh aux/guix/with-container.sh'
else
RUNNER='sh -c'
fi
diff --git a/aux/ci/git-post-receive.sh b/aux/ci/git-post-receive.sh
index 167ac4a..426bff3 100755
--- a/aux/ci/git-post-receive.sh
+++ b/aux/ci/git-post-receive.sh
@@ -9,6 +9,13 @@ for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do
fi
done
+# shellcheck disable=2034
+read -r _oldrev SHA _refname
+
PROJECT="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix
LOGS_DIR="/opt/ci/$PROJECT/logs"
-"/opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR"
+sh "/opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" "$SHA" ||:
+
+echo 'To retrigger the build, run:'
+echo "cd /srv/http/$PROJECT.git/"
+echo "sh /opt/ci/$PROJECT/ci-build.sh" "$PROJECT" "$LOGS_DIR" "$SHA"
diff --git a/aux/ci/git-pre-push.sh b/aux/ci/git-pre-push.sh
index cccd6e5..eaaa7bd 100755
--- a/aux/ci/git-pre-push.sh
+++ b/aux/ci/git-pre-push.sh
@@ -2,12 +2,13 @@
set -eux
TLD="$(cat aux/tld.txt)"
+. aux/lib.sh
PROJECT="$(basename "$PWD")"
LOGS_DIR="/opt/ci/$PROJECT/logs"
-REMOTE_GIT_DIR="/srv/git/$PROJECT.git"
+REMOTE_GIT_DIR="/srv/http/$PROJECT.git"
-DESCRIPTION="$(mktemp)"
+DESCRIPTION="$(mkstemp)"
if [ -f description ]
then
cp description "$DESCRIPTION"
diff --git a/aux/ci/report.sh b/aux/ci/report.sh
index 69dbea3..1aa41a0 100755
--- a/aux/ci/report.sh
+++ b/aux/ci/report.sh
@@ -2,6 +2,8 @@
set -eu
TLD="$(cat aux/tld.txt)"
+. aux/lib.sh
+
while getopts 'n:o:' flag; do
case "$flag" in
n)
@@ -32,14 +34,9 @@ FAIL='❌'
mkdir -p "$OUTDIR/ci-logs" "$OUTDIR/ci-data"
-OUT="$(mktemp)"
+OUT="$(mkstemp)"
chmod 644 "$OUT"
-git fetch origin refs/notes/ci-data:refs/notes/ci-data ||: &
-git fetch origin refs/notes/ci-logs:refs/notes/ci-logs ||: &
-git fetch origin refs/notes/commits:refs/notes/commits ||: &
-wait
-
for c in $(git notes list | cut -d\ -f2); do
DATA="$(git notes --ref=refs/notes/ci-data show "$c")"
FILENAME="$(echo "$DATA" | cut -d\ -f2)"
@@ -64,7 +61,7 @@ cat <<EOF >> "$OUT"
</head>
<body>
<h1>
- CI logs for <a href="https://$TLD/$PROJECT/">$PROJECT</a>
+ CI logs for <a href="https://$TLD/$PROJECT/en/">$PROJECT</a>
</h1>
<ul>
EOF
diff --git a/aux/lib.sh b/aux/lib.sh
new file mode 100755
index 0000000..c31c4fb
--- /dev/null
+++ b/aux/lib.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+#
+# Generally, utilities that I expected to exist in POSIX, but don't.
+#
+
+uuid() {
+ # Taken from:
+ # https://serverfault.com/a/799198
+ od -xN20 /dev/urandom | \
+ head -1 | \
+ awk '{OFS="-"; print $2$3,$4,$5,$6,$7$8$9}'
+}
+
+tmpname() {
+ echo 'mkstemp(template)' | m4 -D template="${TMPDIR:-/tmp}/m4-tmpname."
+}
+
+mkstemp() {
+ name="$(tmpname)"
+ touch "$name"
+ echo "$name"
+}
+
+mkdtemp() {
+ name="$(tmpname)"
+ rm -f "$name"
+ mkdir "$name"
+ echo "$name"
+}
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index 6c24c3e..d875e0e 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -39,21 +39,21 @@ if [ -z "${PROJECT_UC:-}" ]; then
PROJECT_UC="$PROJECT"
fi
-TODOS_ADD_REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## <a href="#\3"><span class="\1">\1<\/span> \2<\/a>\n<pre class="header-anchor" id="\3">#\3<\/pre>\n/'
-TODOS_CLEANUP_REGEX1='s/(<a><a)/<a/'
-TODOS_CLEANUP_REGEX2='s/<\/a><\/a>/<\/a>/'
-TAGS_REGEX='s/tag:([\w-]+)/<span class="tag">\1<\/span>/g'
+# shellcheck disable=1004
+IDS_REGEX='s:^## \(TODO\|DOING\|WAITING\|MEETING\|INACTIVE\|NEXT\|CANCELLED\|DONE\|WONTFIX\) \(.*\) {#\(.*\)}\(.*\)$:## <a href="#\3"><span class="\1">\1</span> \2</a>\4\
+<pre class="header-anchor" id="\3">#\3</pre>\
+:g'
+TAGS_REGEX='s|tag:\([a-z0-9-]*\)|<span class="tag">\1</span>|g'
-sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
- -e "s:@PROJECT@:$PROJECT:g" \
- -e "s:@MAILING_LIST@:$MAILING_LIST:g" \
- -e "s:@TLD@:$TLD:g" \
- < aux/workflow/preamble.md | \
- printf \
- '%s\n\n%s' \
- "$(cat -)" \
- "$(perl -pe "$TODOS_ADD_REGEX" TODOs.md | perl -pe "$TAGS_REGEX")" | \
+cat aux/workflow/preamble.md TODOs.md | \
+ sed \
+ -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
+ -e "s:@PROJECT@:$PROJECT:g" \
+ -e "s:@MAILING_LIST@:$MAILING_LIST:g" \
+ -e "s:@TLD@:$TLD:g" \
+ -e "$IDS_REGEX" \
+ -e "$TAGS_REGEX" | \
pandoc \
--toc \
--highlight-style pygments \
@@ -64,8 +64,8 @@ sed -e "s:@PROJECT_UC@:$PROJECT_UC:g" \
-r commonmark \
-w html \
-H aux/workflow/favicon.html \
- -H aux/workflow/style.css \
- | \
- perl -pe "$TODOS_CLEANUP_REGEX1" | \
- perl -pe "$TODOS_CLEANUP_REGEX2" \
+ -H aux/workflow/style.css | \
+ sed \
+ -e 's:<a><a:<a:g' \
+ -e 's:</a></a>:</a>:g' \
> "$OUTDIR/TODOs.html"
diff --git a/aux/workflow/assert-changelog.sh b/aux/workflow/assert-changelog.sh
index 11088a8..7f9117f 100755
--- a/aux/workflow/assert-changelog.sh
+++ b/aux/workflow/assert-changelog.sh
@@ -31,7 +31,7 @@ if [ -z "${PROJECT_UC:-}" ]; then
PROJECT_UC="$PROJECT"
fi
-HOMEPAGE_LINK="Changelog for [$PROJECT_UC](https://$TLD/$PROJECT/)."
+HOMEPAGE_LINK="Changelog for [$PROJECT_UC](https://$TLD/$PROJECT/en/)."
if ! grep -qF "$HOMEPAGE_LINK" CHANGELOG.md; then
echo "Missing link to homepage in CHANGELOG.md:" >&2
diff --git a/aux/workflow/assert-readme.sh b/aux/workflow/assert-readme.sh
index f8a05a4..333a753 100755
--- a/aux/workflow/assert-readme.sh
+++ b/aux/workflow/assert-readme.sh
@@ -2,6 +2,8 @@
set -eu
TLD="$(cat aux/tld.txt)"
+. aux/lib.sh
+
while getopts 'n:m:' flag; do
case "$flag" in
n)
@@ -27,7 +29,7 @@ assert_arg() {
assert_arg "${PROJECT:-}" '-n PROJECT'
assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
-EXPECTED="$(mktemp)"
+EXPECTED="$(mkstemp)"
cat <<EOF >> "$EXPECTED"
For running the extra development-only checks, run:
@@ -47,21 +49,21 @@ Send contributions to the [mailing list] via [\`git send-email\`](https://git-se
## Links
-- [homepage](https://$TLD/$PROJECT/)
+- [homepage](https://$TLD/$PROJECT/en/)
- [source code](https://git.euandreh.xyz/$PROJECT/)
- [bug tracking](https://$TLD/$PROJECT/TODOs.html)
- [mailing list]
- [CI logs](https://$TLD/$PROJECT/ci.html)
-- [CHANGELOG](https://$TLD/$PROJECT/CHANGELOG.html)
+- [CHANGELOG](https://$TLD/$PROJECT/en/CHANGELOG.html)
[mailing list]: https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D
EOF
-RELEASES_LIST="$(mktemp)"
+RELEASES_LIST="$(mkstemp)"
add_release() {
DATE="$1"
VVERSION="$2"
- echo "- [$VVERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.gz](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.gz.asc)), released in $DATE" >> "$RELEASES_LIST"
+ echo "- [$VVERSION](https://git.euandreh.xyz/$PROJECT/commit/?id=$VVERSION) [$PROJECT-$VVERSION.tar.xz](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.xz) ([sig](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$VVERSION.tar.xz.asc)) - $DATE" >> "$RELEASES_LIST"
}
for VVERSION in $(git tag); do
diff --git a/aux/workflow/assert-todos.sh b/aux/workflow/assert-todos.sh
index ca73b7f..dfa1ab7 100755
--- a/aux/workflow/assert-todos.sh
+++ b/aux/workflow/assert-todos.sh
@@ -29,8 +29,8 @@ h2flag == 1 {
h2flag = 0
}
-/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE)/ {
- if (match($0, / \{#.*?\}$/) == 0) {
+/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE|WONTFIX)/ {
+ if (match($0, / \{#.*?\}.*$/) == 0) {
print "Missing ID for line " NR ":\n" $0
exitstatus = 1
}
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
index b196867..6f5e59b 100755
--- a/aux/workflow/commonmark.sh
+++ b/aux/workflow/commonmark.sh
@@ -1,21 +1,15 @@
#!/bin/sh
set -eu
-while getopts 'N:o:r:w:L:' flag; do
+while getopts 'N:t:l:' flag; do
case "$flag" in
N)
PROJECT_UC="$OPTARG"
;;
- o)
- OUTDIR="$OPTARG"
+ t)
+ TITLE="$OPTARG"
;;
- r)
- IN_FILE="$OPTARG"
- ;;
- w)
- OUT_FILE="$OPTARG"
- ;;
- L)
+ l)
THE_LANG="$OPTARG"
;;
*)
@@ -33,25 +27,16 @@ assert_arg() {
}
assert_arg "${PROJECT_UC:-}" '-N PROJECT_UC'
-assert_arg "${OUTDIR:-}" '-o OUTDIR'
-assert_arg "${IN_FILE:-}" '-i IN_FILE'
-assert_arg "${THE_LANG:-}" '-L THE_LANG'
-
-if [ -z "${OUT_FILE:-}" ]; then
- OUT_FILE="${IN_FILE%.md}.html"
-fi
-
-OUT="$OUTDIR/$OUT_FILE"
-mkdir -p "$(dirname "$OUT")"
+assert_arg "${TITLE:-}" '-t TITLE'
+assert_arg "${THE_LANG:-}" '-l THE_LANG'
pandoc \
- --toc \
- --highlight-style pygments \
- --toc-depth=2 \
- -s \
- --metadata title="$PROJECT_UC - ${IN_FILE%%.*}" \
- --metadata "lang=$THE_LANG" \
- -r commonmark \
- -w html \
- -H aux/workflow/favicon.html \
- < "$IN_FILE" > "$OUT"
+ --toc \
+ --highlight-style pygments \
+ --toc-depth=2 \
+ -s \
+ --metadata title="$PROJECT_UC - $TITLE" \
+ --metadata "lang=$THE_LANG" \
+ -r commonmark \
+ -w html \
+ -H aux/workflow/favicon.html
diff --git a/aux/workflow/dist.sh b/aux/workflow/dist.sh
index 69c0173..15593f4 100755
--- a/aux/workflow/dist.sh
+++ b/aux/workflow/dist.sh
@@ -73,7 +73,7 @@ sh aux/workflow/sign-tarballs.sh -n "$PROJECT"
cat <<EOF >&2
Now push the tag and the signature before pushing the commit:
-git push origin refs/notes/signatures/tar.gz -o skip-ci --no-verify
+git push origin refs/notes/signatures/tar.xz -o skip-ci --no-verify
git push --tags -o skip-ci --no-verify
git push
diff --git a/aux/workflow/preamble.md b/aux/workflow/preamble.md
index dcc2fc3..ee32d58 100644
--- a/aux/workflow/preamble.md
+++ b/aux/workflow/preamble.md
@@ -1,9 +1,9 @@
# About
-TODOs for [@PROJECT_UC@](https://@TLD@/@PROJECT@/).
+TODOs for [@PROJECT_UC@](https://@TLD@/@PROJECT@/en/).
Register a new one at
-[~euandreh/@MAILING_LIST@@lists.sr.ht](mailto:~euandreh/@MAILING_LIST@@lists.sr.ht?subject=%5B@PROJECT@%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E)
+<span id="new">[~euandreh/@MAILING_LIST@@lists.sr.ht](mailto:~euandreh/@MAILING_LIST@@lists.sr.ht?subject=%5B@PROJECT@%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E)</span>
and see [existing discussions](https://lists.sr.ht/~euandreh/@MAILING_LIST@?search=%5B@PROJECT@%5D).
*Você também pode escrever em português*.
diff --git a/aux/workflow/public.sh b/aux/workflow/public.sh
index be32ac1..f9f3b3d 100755
--- a/aux/workflow/public.sh
+++ b/aux/workflow/public.sh
@@ -33,30 +33,25 @@ assert_arg() {
fi
}
-assert_arg "${PROJECT:-}" '-n PROJECT'
-assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
-assert_arg "${OUTDIR:-}" '-o OUTDIR'
-
-if [ -z "${PROJECT_UC:-}" ]; then
- PROJECT_UC="$PROJECT"
-fi
+assert_arg "${PROJECT:-}" '-n PROJECT'
+assert_arg "${MAILING_LIST:-}" '-m MAILING_LIST'
+assert_arg "${OUTDIR:-}" '-o OUTDIR'
+assert_arg "${LANGS:-}" '-l LANGS'
+PROJECT_UC="${PROJECT_UC:-$PROJECT}"
mkdir -p "$OUTDIR"
sh aux/workflow/TODOs.sh -N "$PROJECT_UC" -n "$PROJECT" -m "$MAILING_LIST" -o "$OUTDIR"
-sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r README.md -w index.html -Len
-if [ -f CHANGELOG.md ]; then
- sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r CHANGELOG.md -Len
-fi
-if [ -n "${LANGS:-}" ]; then
- for lang in $LANGS; do
- sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r "README.$lang.md" -w "$lang/index.html" -L "$lang"
- if [ -f CHANGELOG.md ]; then
- sh aux/workflow/commonmark.sh -N "$PROJECT" -o "$OUTDIR" -r "CHANGELOG.$lang.md" -w "$lang/CHANGELOG.html" -L "$lang"
- fi
- done
-fi
+for lang in $LANGS; do
+ mkdir -p "$OUTDIR/$lang/"
+ sh aux/workflow/commonmark.sh -N "$PROJECT" -t README -l "$lang" < "README.$lang.md" > "$OUTDIR/$lang/index.html"
+ sh aux/workflow/commonmark.sh -N "$PROJECT" -t CHANGELOG -l "$lang" < "CHANGELOG.$lang.md" > "$OUTDIR/$lang/CHANGELOG.html"
+ cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR/$lang"
+done
-sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"
+ln -fs en/index.html "$OUTDIR/index.html"
+ln -fs en/CHANGELOG.html "$OUTDIR/CHANGELOG.html"
cp aux/workflow/favicon.svg aux/workflow/favicon.png "$OUTDIR"
+
+sh aux/ci/report.sh -n "$PROJECT" -o "$OUTDIR"
diff --git a/aux/workflow/sign-tarballs.sh b/aux/workflow/sign-tarballs.sh
index 168d38d..3775e28 100755
--- a/aux/workflow/sign-tarballs.sh
+++ b/aux/workflow/sign-tarballs.sh
@@ -23,13 +23,13 @@ assert_arg() {
assert_arg "${PROJECT:-}" '-n PROJECT'
-SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.gz list | cut -d\ -f2)"
+SIGNATURES="$(git notes --ref=refs/notes/signatures/tar.xz list | cut -d\ -f2)"
for tag in $(git tag); do
COMMIT="$(git rev-list -n1 "$tag")"
if ! echo "$SIGNATURES" | grep -qF "$COMMIT"; then
echo "Adding missing signature to $tag" >&2
- git notes --ref=refs/notes/signatures/tar.gz add -f -C "$(
- git archive --format tar.gz --prefix "$PROJECT-${tag#v}/" "$tag" |
+ git notes --ref=refs/notes/signatures/tar.xz add -C "$(
+ git archive --format tar.xz --prefix "$PROJECT-$tag/" "$tag" |
gpg --output - --armor --detach-sign |
git hash-object -w --stdin
)" "$tag"
diff --git a/aux/workflow/style.css b/aux/workflow/style.css
index d7935d0..d72991e 100644
--- a/aux/workflow/style.css
+++ b/aux/workflow/style.css
@@ -1,46 +1,41 @@
<style>
- hr {
- background-color: #ccc;
- }
-
- div.header-anchor {
- opacity: 0.5;
- }
-
- span.tag {
- font-family: monospace;
- font-size: 70%;
- background-color: lightgray;
- padding: 3px;
- border-radius: 5px;
- }
-
- /*
- Replicate colors from:
- https://git.euandreh.xyz/dotfiles/tree/spacemacs.el?id=fcd9f9c4ef399d45d54927382dc1cdde251ebb0a#n866
- */
-
- .TODO {
- color: brown;
- }
-
- .DOING {
- color: yellowgreen;
- }
-
- .WAITING, .MEETING {
- color: gray;
- }
-
- .INACTIVE {
- color: orange;
- }
-
- .NEXT {
- color: red;
- }
-
- .CANCELLED, .DONE {
- color: green;
- }
+ hr {
+ background-color: #ccc;
+ }
+
+ .header-anchor {
+ opacity: 0.5;
+ }
+
+ .tag {
+ font-family: monospace;
+ font-size: 70%;
+ background-color: lightgray;
+ padding: 3px;
+ border-radius: 5px;
+ }
+
+ .TODO {
+ color: brown;
+ }
+
+ .DOING {
+ color: yellowgreen;
+ }
+
+ .WAITING, .MEETING {
+ color: orange;
+ }
+
+ .INACTIVE {
+ color: gray;
+ }
+
+ .NEXT {
+ color: red;
+ }
+
+ .CANCELLED, .DONE, .WONTFIX {
+ color: green;
+ }
</style>