aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2021-02-17 21:50:35 -0300
committerEuAndreh <eu@euandre.org>2021-02-17 21:50:35 -0300
commitccc4dbc1395771532e1664a852c88386fe6990f2 (patch)
treeff52baa69142f1692ae0d994e096ed54d0309c78
parentRearrange Makefile.in, using loops for manpages (diff)
downloadremembering-ccc4dbc1395771532e1664a852c88386fe6990f2.tar.gz
remembering-ccc4dbc1395771532e1664a852c88386fe6990f2.tar.xz
Update files under aux/
-rwxr-xr-xaux/assert-clang-format.sh16
-rwxr-xr-xaux/ci/ci-build.sh15
-rwxr-xr-xaux/ci/report.sh69
-rw-r--r--aux/guix/pinned-channels.scm2
-rwxr-xr-xaux/guix/with-container.sh12
-rwxr-xr-xaux/workflow/README.sh2
-rwxr-xr-xaux/workflow/TODOs.sh2
-rwxr-xr-xaux/workflow/commonmark.sh17
-rw-r--r--aux/workflow/preamble.md2
9 files changed, 125 insertions, 12 deletions
diff --git a/aux/assert-clang-format.sh b/aux/assert-clang-format.sh
new file mode 100755
index 0000000..c7ee6d7
--- /dev/null
+++ b/aux/assert-clang-format.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+set -eu
+
+if [ "${1:-}" = '--fix-in-place' ]; then
+ find . -type f \( -name '*.h' -o -name '*.c' \) -exec clang-format -i {} \;
+ exit 0
+fi
+
+# shellcheck disable=2016
+find . -type f \( -name '*.h' -o -name '*.c' \) -print0 | xargs -0 -I{} sh -c '
+ clang-format "$1" | diff - "$1" || {
+ echo "Unformatted C code. To fix it, run:"
+ echo " ./aux/assert-clang-format.sh --fix-in-place"
+ exit 1
+ }
+' _ {} \;
diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh
index bff1216..7e17a7c 100755
--- a/aux/ci/ci-build.sh
+++ b/aux/ci/ci-build.sh
@@ -20,7 +20,7 @@ See CI logs with:
git notes --ref=refs/notes/ci-logs show $SHA
git notes --ref=refs/notes/ci-data show $SHA
EOF
- )
+)
git notes --ref=refs/notes/ci-data add -f -m "$STATUS $FILENAME"
git notes --ref=refs/notes/ci-logs add -f -F "$LOGFILE"
git notes append -m "$NOTE"
@@ -29,11 +29,12 @@ EOF
trap finish EXIT
unset GIT_DIR
- CLONE="$(mktemp -d)"
- git clone . "$CLONE"
- cd "$CLONE"
+ REMOTE="$PWD"
+ cd "$(mktemp -d)"
+ 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/*
if [ -f aux/guix/with-container.sh ]; then
RUNNER='./aux/guix/with-container.sh'
@@ -41,10 +42,10 @@ EOF
RUNNER='sh -c'
fi
- if [ -f ./bootstrap ]; then
- COMMAND='./bootstrap && ./configure && make clean all check distcheck public'
+ if [ -f ./configure ]; then
+ COMMAND='./configure && make CC=cc clean check public'
else
- COMMAND='make clean check public'
+ COMMAND='make CC=cc clean check public'
fi
$RUNNER "$COMMAND"
diff --git a/aux/ci/report.sh b/aux/ci/report.sh
new file mode 100755
index 0000000..b82c061
--- /dev/null
+++ b/aux/ci/report.sh
@@ -0,0 +1,69 @@
+#!/bin/sh
+set -eu
+
+PROJECT_UC="$1"
+
+PASS='✅'
+FAIL='❌'
+
+mkdir -p public/ci-logs public/ci-data
+
+OUT="$(mktemp)"
+chmod 644 "$OUT"
+
+git fetch origin refs/notes/*:refs/notes/* ||:
+
+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)"
+ echo "$DATA" > "public/ci-data/$FILENAME"
+ git notes --ref=refs/notes/ci-logs show "$c" > "public/ci-logs/$FILENAME"
+done
+
+cat <<EOF >> "$OUT"
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+
+ <style>
+ pre {
+ display: inline;
+ }
+ </style>
+ </head>
+ <body>
+ <h1>
+ CI logs for $PROJECT_UC
+ </h1>
+ <ul>
+EOF
+
+for f in $(find public/ci-data/ -type f | LANG=C.UTF-8 sort -r); do
+ DATA="$(cat "$f")"
+ STATUS="$(echo "$DATA" | cut -d\ -f1)"
+ FILENAME="$(echo "$DATA" | cut -d\ -f2)"
+
+ if [ "$STATUS" = 0 ]; then
+ STATUS_MARKER="$PASS"
+ else
+ STATUS_MARKER="$FAIL"
+ fi
+
+ cat <<EOF >> "$OUT"
+ <li>
+ <a href="ci-logs/$FILENAME">
+ $STATUS_MARKER <pre>$FILENAME</pre>
+ </a>
+ </li>
+EOF
+done
+
+cat <<EOF >> "$OUT"
+ </ul>
+ </body>
+</html>
+EOF
+
+mv "$OUT" public/ci.html
diff --git a/aux/guix/pinned-channels.scm b/aux/guix/pinned-channels.scm
index 67b5a51..f8269ff 100644
--- a/aux/guix/pinned-channels.scm
+++ b/aux/guix/pinned-channels.scm
@@ -3,7 +3,7 @@
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
(commit
- "d265809b782293eb42dd663b4611ca19dd2bf1b3")
+ "f2130228ed86fed81806a662ed59aa74ed2398ed")
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh
index db7b121..6561b2c 100755
--- a/aux/guix/with-container.sh
+++ b/aux/guix/with-container.sh
@@ -1,4 +1,14 @@
#!/bin/sh
set -eux
-guix time-machine -C aux/guix/pinned-channels.scm -- environment --pure -C -m aux/guix/manifest.scm -- sh -c "$@"
+if [ -z "${1:-}" ]; then
+ guix time-machine -C aux/guix/pinned-channels.scm -- \
+ environment -m aux/guix/manifest.scm
+elif [ "$1" = '-p' ]; then
+ guix time-machine -C aux/guix/pinned-channels.scm -- \
+ environment --pure -C -m aux/guix/manifest.scm
+else
+ guix time-machine -C aux/guix/pinned-channels.scm -- \
+ environment --pure -C -m aux/guix/manifest.scm -- \
+ sh -c "$@"
+fi
diff --git a/aux/workflow/README.sh b/aux/workflow/README.sh
index f9e7f52..b9fa38e 100755
--- a/aux/workflow/README.sh
+++ b/aux/workflow/README.sh
@@ -25,6 +25,6 @@ cat "$README" "$RELEASES" | \
-s \
--metadata title="$PROJECT_UC - README" \
--metadata lang=en \
- -r markdown \
+ -r commonmark \
-w html \
> public/index.html
diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh
index ab45835..5dbc761 100755
--- a/aux/workflow/TODOs.sh
+++ b/aux/workflow/TODOs.sh
@@ -17,7 +17,7 @@ envsubst < aux/workflow/preamble.md | \
-s \
--metadata title="$PROJECT_UC - TODOs" \
--metadata lang=en \
- -r markdown \
+ -r commonmark \
-w html \
-H aux/workflow/style.css \
> public/TODOs.html
diff --git a/aux/workflow/commonmark.sh b/aux/workflow/commonmark.sh
new file mode 100755
index 0000000..e9609c2
--- /dev/null
+++ b/aux/workflow/commonmark.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+set -eu
+
+mkdir -p public
+
+PROJECT_UC="$1"
+F="$2"
+
+pandoc --toc \
+ --highlight-style pygments \
+ --toc-depth=2 \
+ -s \
+ --metadata title="$PROJECT_UC - ${F%.*}" \
+ --metadata lang=en \
+ -r commonmark \
+ -w html \
+ < "$F" > "public/${F%.*}.html"
diff --git a/aux/workflow/preamble.md b/aux/workflow/preamble.md
index c6ae56e..7413f58 100644
--- a/aux/workflow/preamble.md
+++ b/aux/workflow/preamble.md
@@ -2,7 +2,7 @@
TODOs for $PROJECT_UC.
-See also [$PROJECT.euandreh.xyz](https://$PROJECT.euandreh.xyz/).
+See also [$PROJECT.euandreh.xyz](https://$PROJECT.euandreh.xyz/) and [CI logs](https://$PROJECT.euandreh.xyz/ci.html).
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)