authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2024-10-12 06:27:30+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-10-11 21:27:30-07:00
log008acd0547751c43f42172eab4879c566698dce3
tree3d84e85f16cda5613d7dcf560e75aecfcfafd57b
parent0367f18cb9dc61090c27e29572a50810b9809822
signaturebadge-check Signed by PGP key B5690EEEBB952194

Replace tidy with superhtml as HTML validator (#21664)

Also add `$HOME/local/bin` to `PATH` in linux CI

5 files changed, 21 insertions(+), 24 deletions(-)

build.zig+13-16
...@@ -32,20 +32,17 @@ pub fn build(b: *std.Build) !void {...@@ -32,20 +32,17 @@ pub fn build(b: *std.Build) !void {
32 const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files;32 const skip_install_langref = b.option(bool, "no-langref", "skip copying of langref to the installation prefix") orelse skip_install_lib_files;
33 const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false;33 const std_docs = b.option(bool, "std-docs", "include standard library autodocs") orelse false;
34 const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false;34 const no_bin = b.option(bool, "no-bin", "skip emitting compiler binary") orelse false;
35 const enable_tidy = b.option(bool, "enable-tidy", "Check langref output HTML validity") orelse false;35 const enable_superhtml = b.option(bool, "enable-superhtml", "Check langref output HTML validity") orelse false;
3636
37 const langref_file = generateLangRef(b);37 const langref_file = generateLangRef(b);
38 const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html");38 const install_langref = b.addInstallFileWithDir(langref_file, .prefix, "doc/langref.html");
39 const check_langref = tidyCheck(b, langref_file);39 const check_langref = superHtmlCheck(b, langref_file);
40 if (enable_tidy) install_langref.step.dependOn(check_langref);40 if (enable_superhtml) install_langref.step.dependOn(check_langref);
41 // Checking autodocs is disabled because tidy gives a false positive:41
42 // line 304 column 9 - Warning: moved <style> tag to <head>! fix-style-tags: no to avoid.42 const check_autodocs = superHtmlCheck(b, b.path("lib/docs/index.html"));
43 // I noticed that `--show-warnings no` still incorrectly causes exit code 1.43 if (enable_superhtml) {
44 // I was unable to find an alternative to tidy.
45 //const check_autodocs = tidyCheck(b, b.path("lib/docs/index.html"));
46 if (enable_tidy) {
47 test_step.dependOn(check_langref);44 test_step.dependOn(check_langref);
48 //test_step.dependOn(check_autodocs);45 test_step.dependOn(check_autodocs);
49 }46 }
50 if (!skip_install_langref) {47 if (!skip_install_langref) {
51 b.getInstallStep().dependOn(&install_langref.step);48 b.getInstallStep().dependOn(&install_langref.step);
...@@ -1358,11 +1355,11 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {...@@ -1358,11 +1355,11 @@ fn generateLangRef(b: *std.Build) std.Build.LazyPath {
1358 return docgen_cmd.addOutputFileArg("langref.html");1355 return docgen_cmd.addOutputFileArg("langref.html");
1359}1356}
13601357
1361fn tidyCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step {1358fn superHtmlCheck(b: *std.Build, html_file: std.Build.LazyPath) *std.Build.Step {
1362 const run_tidy = b.addSystemCommand(&.{1359 const run_superhtml = b.addSystemCommand(&.{
1363 "tidy", "--drop-empty-elements", "no", "-qe",1360 "superhtml", "check",
1364 });1361 });
1365 run_tidy.addFileArg(html_file);1362 run_superhtml.addFileArg(html_file);
1366 run_tidy.expectExitCode(0);1363 run_superhtml.expectExitCode(0);
1367 return &run_tidy.step;1364 return &run_superhtml.step;
1368}1365}
ci/aarch64-linux-debug.sh+2-2
...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"
12PREFIX="$HOME/deps/$CACHE_BASENAME"12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"13ZIG="$PREFIX/bin/zig"
1414
15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$PATH"15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/local/bin:$PATH"
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
...@@ -62,7 +62,7 @@ stage3-debug/bin/zig build test docs \...@@ -62,7 +62,7 @@ stage3-debug/bin/zig build test docs \
62 -Dtarget=native-native-musl \62 -Dtarget=native-native-musl \
63 --search-prefix "$PREFIX" \63 --search-prefix "$PREFIX" \
64 --zig-lib-dir "$PWD/../lib" \64 --zig-lib-dir "$PWD/../lib" \
65 -Denable-tidy65 -Denable-superhtml
6666
67# Ensure that updating the wasm binary from this commit will result in a viable build.67# Ensure that updating the wasm binary from this commit will result in a viable build.
68stage3-debug/bin/zig build update-zig168stage3-debug/bin/zig build update-zig1
ci/aarch64-linux-release.sh+2-2
...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"
12PREFIX="$HOME/deps/$CACHE_BASENAME"12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"13ZIG="$PREFIX/bin/zig"
1414
15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$PATH"15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/local/bin:$PATH"
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
...@@ -62,7 +62,7 @@ stage3-release/bin/zig build test docs \...@@ -62,7 +62,7 @@ stage3-release/bin/zig build test docs \
62 -Dtarget=native-native-musl \62 -Dtarget=native-native-musl \
63 --search-prefix "$PREFIX" \63 --search-prefix "$PREFIX" \
64 --zig-lib-dir "$PWD/../lib" \64 --zig-lib-dir "$PWD/../lib" \
65 -Denable-tidy65 -Denable-superhtml
6666
67# Ensure that stage3 and stage4 are byte-for-byte identical.67# Ensure that stage3 and stage4 are byte-for-byte identical.
68stage3-release/bin/zig build \68stage3-release/bin/zig build \
ci/x86_64-linux-debug.sh+2-2
...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"
12PREFIX="$HOME/deps/$CACHE_BASENAME"12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"13ZIG="$PREFIX/bin/zig"
1414
15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-8.2.1/bin:$PATH"15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-8.2.1/bin:$HOME/local/bin:$PATH"
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
...@@ -71,7 +71,7 @@ stage3-debug/bin/zig build test docs \...@@ -71,7 +71,7 @@ stage3-debug/bin/zig build test docs \
71 -Dtarget=native-native-musl \71 -Dtarget=native-native-musl \
72 --search-prefix "$PREFIX" \72 --search-prefix "$PREFIX" \
73 --zig-lib-dir "$PWD/../lib" \73 --zig-lib-dir "$PWD/../lib" \
74 -Denable-tidy74 -Denable-superhtml
7575
76# Ensure that updating the wasm binary from this commit will result in a viable build.76# Ensure that updating the wasm binary from this commit will result in a viable build.
77stage3-debug/bin/zig build update-zig177stage3-debug/bin/zig build update-zig1
ci/x86_64-linux-release.sh+2-2
...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"...@@ -12,7 +12,7 @@ CACHE_BASENAME="zig+llvm+lld+clang-$TARGET-0.14.0-dev.1622+2ac543388"
12PREFIX="$HOME/deps/$CACHE_BASENAME"12PREFIX="$HOME/deps/$CACHE_BASENAME"
13ZIG="$PREFIX/bin/zig"13ZIG="$PREFIX/bin/zig"
1414
15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-8.2.1/bin:$PATH"15export PATH="$HOME/deps/wasmtime-v10.0.2-$ARCH-linux:$HOME/deps/qemu-linux-x86_64-8.2.1/bin:$HOME/local/bin:$PATH"
1616
17# Make the `zig version` number consistent.17# Make the `zig version` number consistent.
18# This will affect the cmake command below.18# This will affect the cmake command below.
...@@ -71,7 +71,7 @@ stage3-release/bin/zig build test docs \...@@ -71,7 +71,7 @@ stage3-release/bin/zig build test docs \
71 -Dtarget=native-native-musl \71 -Dtarget=native-native-musl \
72 --search-prefix "$PREFIX" \72 --search-prefix "$PREFIX" \
73 --zig-lib-dir "$PWD/../lib" \73 --zig-lib-dir "$PWD/../lib" \
74 -Denable-tidy74 -Denable-superhtml
7575
76# Ensure that stage3 and stage4 are byte-for-byte identical.76# Ensure that stage3 and stage4 are byte-for-byte identical.
77stage3-release/bin/zig build \77stage3-release/bin/zig build \