Skip to content

Commit 85ffd50

Browse files
committed
ci: Check consistency of generated files
This makes the .github/workflows/check-sourcecode more a "check-repo" than a "check-sourcecode".
1 parent 5e261cf commit 85ffd50

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/check-sourcecode.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,21 @@ jobs:
2222

2323
- name: "Check the sourcecode"
2424
run: ./tools/check-sourcecode
25+
26+
check-generated:
27+
name: "Check Generated Files"
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
32+
- uses: actions/checkout@v4
33+
34+
- name: Install prerequisites
35+
run: >-
36+
sudo apt-get update
37+
38+
sudo apt-get install -y
39+
asciidoctor
40+
41+
- name: "Verify elf2tag.1 consistency"
42+
run: ./src/update-elf2tag-manpage --ensure-consistency

src/update-elf2tag-manpage

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
set -e
2626

27+
ensure_consistency=false
2728
case "$1" in
2829
-h | --help )
2930
${SED-sed} -n '/^#\( .*\)$/,$p' "$0" \
@@ -32,6 +33,9 @@ case "$1" in
3233
| ${SED-sed} 's|^#$||; s|^# ||'
3334
exit 0
3435
;;
36+
--ensure-consistency )
37+
ensure_consistency=:
38+
;;
3539
esac
3640

3741
cd "$(dirname "$0")"
@@ -56,6 +60,10 @@ if ! ${ASCIIDOCTOR-asciidoctor} -b manpage -D "$tmpdir" elf2tag.1.adoc; then
5660
fi
5761

5862
if ! test -e elf2tag.1; then
63+
if "$ensure_consistency"; then
64+
echo "Cannot ensure consistency if there is no old elf2tag.1 file"
65+
exit 1
66+
fi
5967
echo "Generate elf2tag.1"
6068
mv -f "$tmpdir/elf2tag.1" elf2tag.1
6169
rmdir "$tmpdir"
@@ -74,6 +82,12 @@ if ${CMP-cmp} "$tmpdir/elf2tag.1.old" "$tmpdir/elf2tag.1.new" > /dev/null; then
7482
exit 0
7583
fi
7684

85+
if "$ensure_consistency"; then
86+
echo "Error: src/elf2tag.1 is inconsistent with src/elf2tag.1.adoc"
87+
diff -u "$tmpdir/elf2tag.1.old" "$tmpdir/elf2tag.1.new"
88+
exit 1
89+
fi
90+
7791
echo "Updating elf2tag.1"
7892
mv -f "$tmpdir/elf2tag.1" elf2tag.1
7993
rm -f "$tmpdir/elf2tag.1.old"

0 commit comments

Comments
 (0)