From db3f54858183744a9f33cd90f7d69148f7dc5864 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 19 Feb 2021 11:22:19 -0300 Subject: Add aux/ci/report.sh --- aux/ci/ci-build.sh | 18 ++++++++---- aux/ci/report.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++ aux/guix/with-container.sh | 6 ++-- aux/workflow/preamble.md | 2 +- 4 files changed, 86 insertions(+), 9 deletions(-) create mode 100755 aux/ci/report.sh (limited to 'aux') diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh index 81ee1fd..1159204 100755 --- a/aux/ci/ci-build.sh +++ b/aux/ci/ci-build.sh @@ -20,20 +20,28 @@ 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" + + cd - + if [ -f ./aux/ci/report.sh ]; then + sh aux/ci/report.sh "$PACKAGE" + rsync -avzzP public/ "/srv/http/$PACKAGE/" --delete + fi + printf "\n>>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS" } 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' @@ -42,7 +50,7 @@ EOF fi if [ -f ./configure ]; then - COMMAND='./configure && make clean check public' + COMMAND='./configure && make CC=cc clean check public' else COMMAND='make CC=cc clean check public' fi 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 <> "$OUT" + + + + + + + + + +

+ CI logs for $PROJECT_UC +

+ + + +EOF + +mv "$OUT" public/ci.html diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh index 3e6a590..6561b2c 100755 --- a/aux/guix/with-container.sh +++ b/aux/guix/with-container.sh @@ -2,11 +2,11 @@ set -eux if [ -z "${1:-}" ]; then - guix time-machine -C aux/guix/pinned-channels.scm -- \ - environment --pure -C -m aux/guix/manifest.scm -elif [ "$1" = '-i' ]; 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 -- \ 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) -- cgit v1.2.3