Skip to content

Commit ac7a472

Browse files
committed
update webstandard.sh
1 parent 1b1fc46 commit ac7a472

File tree

2 files changed

+56
-54
lines changed

2 files changed

+56
-54
lines changed

.github/jobs/webstandard.sh

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -92,62 +92,64 @@ if [ "$NUM_ERRORS" -ne 0 ]; then
9292
fi
9393
section_end
9494
95-
if [ "$TEST" = "w3cval" ]; then
96-
section_start "Remove files from upstream with problems"
97-
rm -rf localhost/domjudge/doc
98-
rm -rf localhost/domjudge/css/fontawesome-all.min.css*
99-
rm -rf localhost/domjudge/bundles/nelmioapidoc*
100-
rm -f localhost/domjudge/css/bootstrap.min.css*
101-
rm -f localhost/domjudge/css/select2-bootstrap*.css*
102-
rm -f localhost/domjudge/css/dataTables*.css*
103-
rm -f localhost/domjudge/jury/config/check/phpinfo*
104-
section_end
105-
106-
section_start "Install testsuite"
107-
cd "$DIR"
108-
wget https://github.com/validator/validator/releases/latest/download/vnu.linux.zip
109-
unzip -q vnu.linux.zip
110-
section_end
111-
112-
FLTR='--filterpattern .*autocomplete.*|.*style.*|.*role=tab.*|.*descendant.*|.*Stray.*|.*attribute.*|.*Forbidden.*|.*stream.*|.*obsolete.*'
113-
for typ in html css svg
114-
do
115-
section_start "Analyse with $typ"
116-
# shellcheck disable=SC2086
117-
"$DIR"/vnu-runtime-image/bin/vnu --errors-only --exit-zero-always --skip-non-$typ --format json $FLTR "$URL" 2> result.json
118-
# shellcheck disable=SC2086
119-
NEWFOUNDERRORS=$("$DIR"/vnu-runtime-image/bin/vnu --errors-only --exit-zero-always --skip-non-$typ --format gnu $FLTR "$URL" 2>&1 | wc -l)
120-
FOUNDERR=$((NEWFOUNDERRORS+FOUNDERR))
121-
python3 -m "json.tool" < result.json > "$ARTIFACTS/w3c$typ$URL.json"
122-
trace_off; python3 gitlab/jsontogitlab.py "$ARTIFACTS/w3c$typ$URL.json"; trace_on
95+
if [ "$TEST" != "none" ] then
96+
if [ "$TEST" = "w3cval" ]; then
97+
section_start "Remove files from upstream with problems"
98+
rm -rf localhost/domjudge/doc
99+
rm -rf localhost/domjudge/css/fontawesome-all.min.css*
100+
rm -rf localhost/domjudge/bundles/nelmioapidoc*
101+
rm -f localhost/domjudge/css/bootstrap.min.css*
102+
rm -f localhost/domjudge/css/select2-bootstrap*.css*
103+
rm -f localhost/domjudge/css/dataTables*.css*
104+
rm -f localhost/domjudge/jury/config/check/phpinfo*
123105
section_end
124-
done
125-
else
126-
section_start "Remove files from upstream with problems"
127-
rm -rf localhost/domjudge/{doc,api}
128-
section_end
129-
130-
if [ "$TEST" == "axe" ]; then
131-
STAN="-e $TEST"
132-
FLTR=""
106+
107+
section_start "Install testsuite"
108+
cd "$DIR"
109+
wget https://github.com/validator/validator/releases/latest/download/vnu.linux.zip
110+
unzip -q vnu.linux.zip
111+
section_end
112+
113+
FLTR='--filterpattern .*autocomplete.*|.*style.*|.*role=tab.*|.*descendant.*|.*Stray.*|.*attribute.*|.*Forbidden.*|.*stream.*|.*obsolete.*'
114+
for typ in html css svg
115+
do
116+
section_start "Analyse with $typ"
117+
# shellcheck disable=SC2086
118+
"$DIR"/vnu-runtime-image/bin/vnu --errors-only --exit-zero-always --skip-non-$typ --format json $FLTR "$URL" 2> result.json
119+
# shellcheck disable=SC2086
120+
NEWFOUNDERRORS=$("$DIR"/vnu-runtime-image/bin/vnu --errors-only --exit-zero-always --skip-non-$typ --format gnu $FLTR "$URL" 2>&1 | wc -l)
121+
FOUNDERR=$((NEWFOUNDERRORS+FOUNDERR))
122+
python3 -m "json.tool" < result.json > "$ARTIFACTS/w3c$typ$URL.json"
123+
trace_off; python3 gitlab/jsontogitlab.py "$ARTIFACTS/w3c$typ$URL.json"; trace_on
124+
section_end
125+
done
133126
else
134-
STAN="-s $TEST"
135-
FLTR0="-E '#DataTables_Table_0 > tbody > tr > td > a','#menuDefault > a','#filter-card > div > div > div > span > span:nth-child(1) > span > ul > li > input',.problem-badge"
136-
FLTR1="'html > body > div > div > div > div > div > div > table > tbody > tr > td > a > span','html > body > div > div > div > div > div > div > form > div > div > div > label'"
137-
FLTR="$FLTR0,$FLTR1"
138-
fi
139-
chown -R domjudge:domjudge "$DIR"
140-
cd "$DIR"
141-
ACCEPTEDERR=5
142-
# shellcheck disable=SC2044,SC2035
143-
for file in $(find $URL -name "*.html")
144-
do
145-
section_start "$file"
146-
su domjudge -c "/home/domjudge/node_modules/.bin/pa11y --config .github/jobs/pa11y_config.json $STAN -r json -T $ACCEPTEDERR $FLTR $file" | python3 -m json.tool
147-
ERR=$(su domjudge -c "/home/domjudge/node_modules/.bin/pa11y --config .github/jobs/pa11y_config.json $STAN -r csv -T $ACCEPTEDERR $FLTR $file" | wc -l)
148-
FOUNDERR=$((ERR+FOUNDERR-1)) # Remove header row
127+
section_start "Remove files from upstream with problems"
128+
rm -rf localhost/domjudge/{doc,api}
149129
section_end
150-
done
130+
131+
if [ "$TEST" == "axe" ]; then
132+
STAN="-e $TEST"
133+
FLTR=""
134+
else
135+
STAN="-s $TEST"
136+
FLTR0="-E '#DataTables_Table_0 > tbody > tr > td > a','#menuDefault > a','#filter-card > div > div > div > span > span:nth-child(1) > span > ul > li > input',.problem-badge"
137+
FLTR1="'html > body > div > div > div > div > div > div > table > tbody > tr > td > a > span','html > body > div > div > div > div > div > div > form > div > div > div > label'"
138+
FLTR="$FLTR0,$FLTR1"
139+
fi
140+
chown -R domjudge:domjudge "$DIR"
141+
cd "$DIR"
142+
ACCEPTEDERR=5
143+
# shellcheck disable=SC2044,SC2035
144+
for file in $(find $URL -name "*.html")
145+
do
146+
section_start "$file"
147+
su domjudge -c "/home/domjudge/node_modules/.bin/pa11y --config .github/jobs/pa11y_config.json $STAN -r json -T $ACCEPTEDERR $FLTR $file" | python3 -m json.tool
148+
ERR=$(su domjudge -c "/home/domjudge/node_modules/.bin/pa11y --config .github/jobs/pa11y_config.json $STAN -r csv -T $ACCEPTEDERR $FLTR $file" | wc -l)
149+
FOUNDERR=$((ERR+FOUNDERR-1)) # Remove header row
150+
section_end
151+
done
152+
fi
151153
fi
152154
153155
echo "Found: " $FOUNDERR

.github/workflows/database-upgrade.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ jobs:
3636
- name: Check for Errors in the Upgrade
3737
run: mysql -hsqlserver -u"root" -p"root" -e "SHOW TABLES FROM domjudge;"
3838
- name: Check for Errors in Domjudge Web
39-
run: .github/jobs/webstandard.sh default admin
39+
run: .github/jobs/webstandard.sh none admin
4040

0 commit comments

Comments
 (0)