diff options
author | EuAndreh <eu@euandre.org> | 2021-01-22 19:24:12 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2021-01-22 19:24:12 -0300 |
commit | 768ab333b9e78af6ef1a9b23484e8e9c54c3a8b1 (patch) | |
tree | 7e2eb0fa8a51016edbbf52fe7d4609b8707eee58 | |
parent | TODOs.md: Add link to Resources section (diff) | |
download | server-768ab333b9e78af6ef1a9b23484e8e9c54c3a8b1.tar.gz server-768ab333b9e78af6ef1a9b23484e8e9c54c3a8b1.tar.xz |
Update shared files under build-aux
-rwxr-xr-x | build-aux/assert-todos.sh | 55 | ||||
-rwxr-xr-x | build-aux/ci/ci-build.sh | 13 | ||||
-rwxr-xr-x | build-aux/ci/git-pre-push.sh | 19 | ||||
-rw-r--r-- | build-aux/ci/git-pre-push.sh.in | 19 | ||||
-rwxr-xr-x | build-aux/workflow/README.sh | 29 | ||||
-rwxr-xr-x | build-aux/workflow/TODOs.sh | 18 | ||||
-rw-r--r-- | build-aux/workflow/preamble.md | 5 |
7 files changed, 96 insertions, 62 deletions
diff --git a/build-aux/assert-todos.sh b/build-aux/assert-todos.sh index 91015fe..0b0a8d6 100755 --- a/build-aux/assert-todos.sh +++ b/build-aux/assert-todos.sh @@ -7,33 +7,28 @@ if git grep FIXME | grep -v '^TODOs.md' | grep -v '^build-aux/assert-todos.sh' | exit 1 fi -KNOWN_IDS='' -has_error=0 -# shellcheck disable=2013 -for todo in $(sed -e '/^\* Tasks$/,/^\* Improvements$/!d' TODOs.md | grep -nE '^\*\* .*$' | cut -d: -f1); do - if sed "${todo}q;d" TODOs.md | grep -qE '^\*\* (CANCELLED|DONE)'; then - ID_OFFSET=3 - else - ID_OFFSET=2 - fi - line_n="$((todo+ID_OFFSET))" - ID_LINE="$(sed "${line_n}q;d" TODOs.md)" - if echo "$ID_LINE" | grep -q '^:CUSTOM_ID: .*$'; then - ID="$(echo "$ID_LINE" | awk '{print $2}')" - if echo "$KNOWN_IDS" | grep -q "$ID"; then - echo "Duplicated ID: $ID" - has_error=1 - else - if [ -z "$KNOWN_IDS" ]; then - KNOWN_IDS="$ID" - else - KNOWN_IDS="$KNOWN_IDS:$ID" - fi - fi - else - echo "Missing ID for TODO in line $line_n" - has_error=1 - fi -done - -exit "$has_error" +awk -F'{#' ' +BEGIN { + status=0 + idx=0 + delete ids[0] +} +/^## / { + if (match($0, / \{#.*?\}$/) == 0) { + print "Missing ID for line " NR ":\n" $0 + status=1 + } + id_with_prefix = substr($2, 0, length($2) - 1) + match(id_with_prefix, /^\w+-/) + id = substr(id_with_prefix, RLENGTH + 1) + if (id in arr) { + print "Duplicate ID: " id + status=1 + } else { + arr[id] = 1 + } +} +/^# Improvements$/ { + exit status +} +' TODOs.md diff --git a/build-aux/ci/ci-build.sh b/build-aux/ci/ci-build.sh index 93c9ee1..b7a4c38 100755 --- a/build-aux/ci/ci-build.sh +++ b/build-aux/ci/ci-build.sh @@ -35,10 +35,19 @@ EOF git config --global user.email git@euandre.org git config --global user.name 'EuAndreh CI' + if [ -f build-aux/with-container.sh ]; then + RUNNER='./build-aux/with-container.sh' + else + RUNNER='sh -c' + fi + if [ -f ./bootstrap ]; then - ./build-aux/with-container.sh './bootstrap && ./configure --enable-programmer-mode --enable-ci-mode && make clean all check distcheck public' + COMMAND='./bootstrap && ./configure --enable-programmer-mode --enable-ci-mode && make clean all check distcheck public' else - ./build-aux/with-container.sh 'make clean check public' + COMMAND='make clean check public' fi + + $RUNNER "$COMMAND" + rsync -avzzP public/ "/srv/http/$PACKAGE/" --delete } | tee "$LOGFILE" 2>&1 diff --git a/build-aux/ci/git-pre-push.sh b/build-aux/ci/git-pre-push.sh new file mode 100755 index 0000000..2d2bcb1 --- /dev/null +++ b/build-aux/ci/git-pre-push.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eux + +PACKAGE="$(basename "$PWD")" +LOGS_DIR="/data/ci/$PACKAGE/logs" +REMOTE_GIT_DIR="/data/git/$PACKAGE.git" + +DESCRIPTION="$(mktemp)" +if [ -f description ] +then + cp description "$DESCRIPTION" +else + git config euandreh.description > "$DESCRIPTION" +fi + +scp "$DESCRIPTION" "git.euandreh.xyz:$REMOTE_GIT_DIR/description" +ssh git.euandreh.xyz mkdir -p "$LOGS_DIR" +scp build-aux/ci/ci-build.sh "git.euandreh.xyz:$(dirname "$LOGS_DIR")/ci-build.sh" +scp build-aux/ci/git-post-receive.sh "git.euandreh.xyz:$REMOTE_GIT_DIR/hooks/post-receive" diff --git a/build-aux/ci/git-pre-push.sh.in b/build-aux/ci/git-pre-push.sh.in deleted file mode 100644 index 16428d6..0000000 --- a/build-aux/ci/git-pre-push.sh.in +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -set -eux - -PACKAGE="$(basename "$PWD")" -LOGS_DIR="/data/ci/$PACKAGE/logs" -REMOTE_GIT_DIR="/data/git/$PACKAGE.git" - -DESCRIPTION="$(mktemp)" -if [ -f description ] -then - cp description "$DESCRIPTION" -else - git config euandreh.description > "$DESCRIPTION" -fi - -scp "$DESCRIPTION" "git.@TLD@:$REMOTE_GIT_DIR/description" -ssh git.@TLD@ mkdir -p "$LOGS_DIR" -scp build-aux/ci/ci-build.sh "git.@TLD@:$(dirname "$LOGS_DIR")/ci-build.sh" -scp build-aux/ci/git-post-receive.sh "git.@TLD@:$REMOTE_GIT_DIR/hooks/post-receive" diff --git a/build-aux/workflow/README.sh b/build-aux/workflow/README.sh new file mode 100755 index 0000000..1aa2593 --- /dev/null +++ b/build-aux/workflow/README.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -eu + +mkdir -p public + +PROJECT_UC="$1" +PROJECT="$2" + +RELEASES_LIST="$(mktemp)" +for version in $(git tag); do + echo "- version [$version](https://git.euandreh.xyz/$PROJECT/snapshot/$PROJECT-$version.tar.gz), released in $(git log -1 --format=%cd --date=short "$version")" >> "$RELEASES_LIST" +done + +RELEASES="$(mktemp)" +if [ -s "$RELEASES_LIST" ]; then + printf '# Releases\n\n' >> "$RELEASES" + cat "$RELEASES_LIST" >> "$RELEASES" +fi + +cat README.md "$RELEASES" | \ + pandoc --toc \ + --highlight-style pygments \ + --toc-depth=2 \ + -s \ + --metadata title="$PROJECT_UC - TODOs" \ + --metadata lang=en \ + -r markdown \ + -w html \ + > public/index.html diff --git a/build-aux/workflow/TODOs.sh b/build-aux/workflow/TODOs.sh index 4a9eb65..3f9fa4b 100755 --- a/build-aux/workflow/TODOs.sh +++ b/build-aux/workflow/TODOs.sh @@ -11,13 +11,13 @@ REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#( envsubst < build-aux/workflow/preamble.md | \ printf '%s\n\n%s' "$(cat -)" "$(perl -pe "$REGEX" TODOs.md)" | \ - pandoc --toc \ - --highlight-style pygments \ - --toc-depth=2 \ - -s \ - --metadata title="$1 - TODOs" \ - --metadata lang=en \ - -H build-aux/workflow/style.css \ - -r markdown \ - -w html \ + pandoc --toc \ + --highlight-style pygments \ + --toc-depth=2 \ + -s \ + --metadata title="$PROJECT_UC - TODOs" \ + --metadata lang=en \ + -r markdown \ + -w html \ + -H build-aux/workflow/style.css \ > public/TODOs.html diff --git a/build-aux/workflow/preamble.md b/build-aux/workflow/preamble.md index ac75d9d..c6ae56e 100644 --- a/build-aux/workflow/preamble.md +++ b/build-aux/workflow/preamble.md @@ -4,8 +4,9 @@ TODOs for $PROJECT_UC. See also [$PROJECT.euandreh.xyz](https://$PROJECT.euandreh.xyz/). -Register a new one: -[~euandreh/$MAILING_LIST@lists.sr.ht](mailto:~euandreh/$MAILING_LIST@lists.sr.ht?subject=BUG%20or%20TASK%3A%20%3Cdescription%3E). +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) +and see [existing discussions](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D). *Você também pode escrever em português*. |