Skip to content

Commit c782c3e

Browse files
avargitster
authored andcommitted
CI: split up and reduce "ci/test-documentation.sh"
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 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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 12a1513 commit c782c3e

File tree

4 files changed

+35
-32
lines changed

4 files changed

+35
-32
lines changed

.github/workflows/main.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,18 @@ jobs:
365365
steps:
366366
- uses: actions/checkout@v2
367367
- run: ci/install-dependencies.sh
368-
- run: ci/test-documentation.sh
368+
- run: ci/lib.sh
369+
- run: make check-docs
370+
- run: "make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)"
371+
shell: bash
372+
- run: ci/test-documentation.sh AsciiDoc
373+
if: success()
374+
- run: ci/check-unignored-build-artifacts.sh
375+
if: success()
376+
- run: make clean
377+
- run: "make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)"
378+
shell: bash
379+
- run: ci/test-documentation.sh Asciidoctor
380+
if: success()
381+
- run: ci/check-unignored-build-artifacts.sh
382+
if: success()

ci/check-unignored-build-artifacts.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,14 @@
55

66
. ${0%/*}/lib.sh
77

8+
check_unignored_build_artifacts ()
9+
{
10+
! git ls-files --other --exclude-standard --error-unmatch \
11+
-- ':/*' 2>/dev/null ||
12+
{
13+
echo "$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)"
14+
false
15+
}
16+
}
17+
818
check_unignored_build_artifacts

ci/lib.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ setenv () {
3939
fi
4040
}
4141

42-
check_unignored_build_artifacts ()
43-
{
44-
! git ls-files --other --exclude-standard --error-unmatch \
45-
-- ':/*' 2>/dev/null ||
46-
{
47-
echo "$(tput setaf 1)error: found unignored build artifacts$(tput sgr0)"
48-
false
49-
}
50-
}
51-
5242
# GitHub Action doesn't set TERM, which is required by tput
5343
setenv TERM ${TERM:-dumb}
5444

ci/test-documentation.sh

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22
#
3-
# Perform sanity checks on documentation and build it.
3+
# Perform sanity checks on "make doc" output and built documentation
44
#
55

66
. ${0%/*}/lib.sh
77

8+
generator=$1
9+
810
filter_log () {
911
sed -e '/^GIT_VERSION = /d' \
1012
-e "/constant Gem::ConfigMap is deprecated/d" \
@@ -14,28 +16,15 @@ filter_log () {
1416
"$1"
1517
}
1618

17-
make check-docs
18-
19-
# Build docs with AsciiDoc
20-
make doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)
21-
cat stderr.raw
22-
filter_log stderr.raw >stderr.log
23-
test ! -s stderr.log
24-
test -s Documentation/git.html
25-
test -s Documentation/git.xml
26-
test -s Documentation/git.1
27-
grep '<meta name="generator" content="AsciiDoc ' Documentation/git.html
28-
29-
rm -f stdout.log stderr.log stderr.raw
30-
check_unignored_build_artifacts
31-
32-
# Build docs with AsciiDoctor
33-
make clean
34-
make USE_ASCIIDOCTOR=1 doc > >(tee stdout.log) 2> >(tee stderr.raw >&2)
3519
cat stderr.raw
3620
filter_log stderr.raw >stderr.log
3721
test ! -s stderr.log
3822
test -s Documentation/git.html
39-
grep '<meta name="generator" content="Asciidoctor ' Documentation/git.html
23+
if test "$generator" = "Asciidoctor"
24+
then
25+
test -s Documentation/git.xml
26+
test -s Documentation/git.1
27+
fi
28+
grep "<meta name=\"generator\" content=\"$generator " Documentation/git.html
4029

4130
rm -f stdout.log stderr.log stderr.raw

0 commit comments

Comments
 (0)