Skip to content

Commit 11f24bb

Browse files
authored
Cleanup, ::error:: usage, input validation, README (#38)
1 parent 9d826f2 commit 11f24bb

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979
with:
8080
use-latex: 'true'
8181
- name: 'Upload documentation'
82-
uses: actions/upload-artifact@v4
82+
uses: actions/upload-artifact@v5
8383
with:
8484
name: manual
8585
path: ./doc/manual.pdf

action.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,41 @@ inputs:
1313
runs:
1414
using: "composite"
1515
steps:
16+
- name: "Validate input"
17+
shell: bash
18+
run: |
19+
validate_boolean() {
20+
local input=$1
21+
local option_name=$2
22+
if ! [[ "$input" =~ ^(true|false)$ ]]; then
23+
echo "::error::Invalid value for option $option_name. Expected 'true' or 'false', but found '$input'"
24+
exit 1;
25+
fi
26+
}
27+
28+
validate_boolean "${{ inputs.use-latex }}" use-latex
29+
validate_boolean "${{ inputs.warnings-as-errors }}" warnings-as-errors
30+
1631
- name: "Install tth (for old-style documentation)"
1732
shell: bash
1833
run: |
1934
sudo apt-get update
2035
sudo apt-get install --no-install-recommends tth
36+
2137
- name: "Install TeX Live"
2238
if: ${{ inputs.use-latex == 'true' }}
2339
shell: bash
2440
run: |
2541
sudo apt-get install --no-install-recommends texlive-latex-base texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
42+
2643
- name: "Check for GAP manual"
2744
shell: bash
2845
run: |
2946
cd $GAPROOT/doc/ref
3047
if [ ! -f manual.six ]; then
3148
cd $GAPROOT
3249
make html || :
33-
# build a HTML version of the GAP reference manual to allow subsequent
50+
# build an HTML version of the GAP reference manual to allow subsequent
3451
# steps to pass when building a package manual that contains refs to
3552
# the GAP reference manual.
3653
# There is a caveat, though: building the GAP reference manual in turn
@@ -39,8 +56,11 @@ runs:
3956
# install a full package distribution when running tests.
4057
# See also <https://github.com/gap-actions/build-pkg-docs/issues/22>.
4158
fi
59+
4260
- name: "Compile documentation"
4361
shell: bash
62+
env:
63+
SOURCE_DATE_EPOCH: 0 # prevent time stamps in generated PDF
4464
run: |
4565
if [ -f "makedoc.g" ]; then
4666
$GAP -c 'PushOptions(rec(relativePath:="../../..")); Read("makedoc.g"); QUIT;' 2>&1 | tee $RUNNER_TEMP/output.log
@@ -55,28 +75,28 @@ runs:
5575
[ -d ../../etc ] && echo "../../etc exists" || ln -s $GAPROOT/etc ../../etc
5676
cd doc && ./make_doc 2>&1 | tee $RUNNER_TEMP/output.log
5777
elif [ -f "doc/make_doc" ]; then
58-
echo "doc/make_doc exists but is not executable!"
78+
echo "::error::doc/make_doc exists but is not executable!"
5979
exit 1
6080
else
61-
echo "no makedoc.g file or doc/make_doc script found!"
81+
echo "::error::no makedoc.g file or doc/make_doc script found!"
6282
exit 1
6383
fi
64-
env:
65-
SOURCE_DATE_EPOCH: 0 # prevent time stamps in generated PDF
84+
6685
- name: "Check for warnings"
6786
if: ${{ inputs.warnings-as-errors == 'true' }}
6887
shell: bash
6988
# The below checks for warnings produced whilst the docs were being built,
7089
# apart from the warning LaTeX produces when labels may have changed.
7190
# As discussed in https://github.com/BNasmith/alco/issues/24, the LaTeX
7291
# label warnings are sometimes false positives. Moreover, GAPDoc can
73-
# identify this issues, hence we ignore the ones from LaTeX.
92+
# identify these issues, hence we ignore the ones from LaTeX.
7493
run: |
7594
if grep -i -e "warning\b" $RUNNER_TEMP/output.log | grep -qiv "LaTeX Warning: Label(s) may have changed."; then
76-
echo "Warnings were found when building the documentation!"
95+
echo "::error::Warnings were found when building the documentation!"
7796
grep -i -e "warning\b" $RUNNER_TEMP/output.log
7897
exit 1
7998
fi
99+
80100
- name: "Check documentation is compiled"
81101
shell: bash
82102
run: |
@@ -93,15 +113,18 @@ runs:
93113
for doc_info in doc_infos do
94114
for filename in filenames do
95115
if not IsExistingFile( doc_info.(filename) ) then
96-
Error(
116+
Exec(
97117
Concatenation(
118+
"echo \"::error::",
98119
"The documentation has supposedly been built, but the file ",
99120
doc_info.(filename),
100121
" specified in PackageDoc.",
101122
filename,
102-
" does not exist."
123+
" does not exist.",
124+
"\""
103125
)
104126
);
127+
FORCE_QUIT_GAP(1);
105128
fi;
106129
od;
107130
od;

0 commit comments

Comments
 (0)