@@ -365,4 +365,18 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: ci/install-dependencies.sh
- - run: ci/test-documentation.sh
+ - run: ci/lib.sh
+ - run: make check-docs
+ - run: "make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)"
+ shell: bash
+ - run: ci/test-documentation.sh AsciiDoc
+ if: success()
+ - run: ci/check-unignored-build-artifacts.sh
+ if: success()
+ - run: make clean
+ - run: "make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)"
+ shell: bash
+ - run: ci/test-documentation.sh Asciidoctor
+ if: success()
+ - run: ci/check-unignored-build-artifacts.sh
+ if: success()
@@ -5,4 +5,14 @@
. ${0%/*}/lib.sh
+check_unignored_build_artifacts ()
+{
+ ! git ls-files --other --exclude-standard --error-unmatch \
+ -- ':/*' 2>/dev/null ||
+ {
+ echo "$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)"
+ false
+ }
+}
+
check_unignored_build_artifacts
@@ -47,16 +47,6 @@ setenv () {
fi
}
-check_unignored_build_artifacts ()
-{
- ! git ls-files --other --exclude-standard --error-unmatch \
- -- ':/*' 2>/dev/null ||
- {
- echo "$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)"
- false
- }
-}
-
# GitHub Action doesn't set TERM, which is required by tput
setenv TERM ${TERM:-dumb}
@@ -1,10 +1,12 @@
-#!/usr/bin/env bash
+#!/bin/sh
#
-# Perform sanity checks on documentation and build it.
+# Perform sanity checks on "make doc" output and built documentation
#
. ${0%/*}/lib.sh
+generator=$1
+
filter_log () {
sed -e '/^GIT_VERSION = /d' \
-e "/constant Gem::ConfigMap is deprecated/d" \
@@ -14,28 +16,15 @@ filter_log () {
"$1"
}
-make check-docs
-
-# Build docs with AsciiDoc
-make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)
-cat stderr.raw
-filter_log stderr.raw >stderr.log
-test ! -s stderr.log
-test -s Documentation/git.html
-test -s Documentation/git.xml
-test -s Documentation/git.1
-grep '<meta name="generator" content="AsciiDoc ' Documentation/git.html
-
-rm -f stdout.log stderr.log stderr.raw
-check_unignored_build_artifacts
-
-# Build docs with AsciiDoctor
-make clean
-make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)
cat stderr.raw
filter_log stderr.raw >stderr.log
test ! -s stderr.log
test -s Documentation/git.html
-grep '<meta name="generator" content="Asciidoctor ' Documentation/git.html
+if test "$generator" = "Asciidoctor"
+then
+ test -s Documentation/git.xml
+ test -s Documentation/git.1
+fi
+grep "<meta name=\"generator\" content=\"$generator " Documentation/git.html
rm -f stdout.log stderr.log stderr.raw
Change the "ci/test-documentation.sh" script to run the bash-specific parts in as one command in the CI job itself, and to run the two "make doc" commands at the top-level. It'll now be obvious from the title of the step if we failed in the asciidoc or asciidoctor step. Since the "check_unignored_build_artifacts()" function is now only used in "ci/check-unignored-build-artifacts.sh" move that function there. The recipe for the job in ".github/workflows/main.yml" is now a bit verbose because it's effectively the same job twice, with a "make clean" in-between. It would be better for the verbosity to run it via a matrix as done in the alternate approach in [1] does, but then we'd sacrifice overall CPU time for the brevity. It might still be worth doing, but let's go for this simpler approach for now. 1. https://lore.kernel.org/git/patch-v2-6.6-7c423c8283d-20211120T030848Z-avarab@gmail.com/ Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> --- .github/workflows/main.yml | 16 +++++++++++++- ci/check-unignored-build-artifacts.sh | 10 +++++++++ ci/lib.sh | 10 --------- ci/test-documentation.sh | 31 +++++++++------------------ 4 files changed, 35 insertions(+), 32 deletions(-)