mirror of https://github.com/docker/docs.git
ci: replace htmlproofer with wjdp/htmltest
Signed-off-by: David Karlsson <david.karlsson@docker.com>
This commit is contained in:
parent
27485b9f7c
commit
2d44be0fc0
|
@ -35,7 +35,7 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- htmlproofer
|
||||
- htmltest
|
||||
- mdl
|
||||
steps:
|
||||
-
|
||||
|
@ -70,7 +70,7 @@ jobs:
|
|||
|
||||
// construct annotations by parsing output
|
||||
switch ("${{ matrix.target }}") {
|
||||
case "htmlproofer":
|
||||
case "htmltest":
|
||||
const re = /^- (.+)\n \* (.+) \(line (\d+)\)\n(.+)$/gm;
|
||||
while (true) {
|
||||
const result = re.exec(results);
|
||||
|
@ -79,7 +79,7 @@ jobs:
|
|||
}
|
||||
|
||||
core.error(`${result[2]}\n${result[4]}`, {
|
||||
title: 'Link check failed',
|
||||
title: 'HTML test failed',
|
||||
// file: result[1],
|
||||
// startLine: result[3],
|
||||
});
|
||||
|
|
|
@ -10,3 +10,4 @@ CNAME
|
|||
_kbase/**
|
||||
/vendor
|
||||
/lint
|
||||
tmp/.htmltest/**
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
DirectoryPath: "_site"
|
||||
EnforceHTTPS: false
|
||||
CheckDoctype: false
|
||||
CheckExternal: false
|
||||
IgnoreAltMissing: true
|
||||
IgnoreAltEmpty: true
|
||||
IgnoreEmptyHref: true
|
||||
IgnoreDirectoryMissingTrailingSlash: true
|
||||
IgnoreURLs:
|
||||
- "^/docker-hub/api/latest/.*$"
|
||||
- "^/engine/api/v.+/#.*$"
|
||||
- "^/glossary/.*$"
|
||||
IgnoreDirs:
|
||||
- "engine/api"
|
||||
- "registry/configuration"
|
||||
CacheExpires: "6h"
|
29
Dockerfile
29
Dockerfile
|
@ -63,28 +63,27 @@ RUN --mount=type=bind,target=.,rw \
|
|||
bundle exec jekyll build --profile -d ${TARGET} --config ${CONFIG_FILES}
|
||||
EOT
|
||||
|
||||
# htmlproofer checks for broken links
|
||||
FROM gem AS htmlproofer-base
|
||||
RUN --mount=type=bind,from=generate,source=/out,target=_site <<EOF
|
||||
htmlproofer ./_site \
|
||||
--disable-external \
|
||||
--internal-domains="docs.docker.com,docs-stage.docker.com,localhost:4000" \
|
||||
--file-ignore="/^./_site/engine/api/.*$/,./_site/registry/configuration/index.html" \
|
||||
--url-ignore="/^/docker-hub/api/latest/.*$/,/^/engine/api/v.+/#.*$/,/^/glossary/.*$/" > /results 2>&1
|
||||
rc=$?
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
echo -n > /results
|
||||
fi
|
||||
# htmltest checks for broken links
|
||||
FROM wjdp/htmltest:v0.17.0 as htmltest-base
|
||||
RUN --mount=type=bind,from=generate,source=/out,target=_site \
|
||||
--mount=type=bind,source=.htmltest.yml,target=.htmltest.yml \
|
||||
<<EOF
|
||||
htmltest > /results 2>&1
|
||||
rc=$?
|
||||
if [[ $rc -eq 0 ]]; then
|
||||
echo -n > /results
|
||||
fi
|
||||
EOF
|
||||
|
||||
FROM htmlproofer-base as htmlproofer
|
||||
FROM base as htmltest
|
||||
COPY --from=htmltest-base /results /results
|
||||
RUN <<EOF
|
||||
cat /results
|
||||
[ ! -s /results ] || exit 1
|
||||
EOF
|
||||
|
||||
FROM scratch as htmlproofer-output
|
||||
COPY --from=htmlproofer-base /results /results
|
||||
FROM scratch as htmltest-output
|
||||
COPY --from=htmltest-base /results /results
|
||||
|
||||
# mdl is a lint tool for markdown files
|
||||
FROM gem AS mdl-base
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -17,7 +17,6 @@ gem 'rouge', '3.27.0'
|
|||
|
||||
gem 'front_matter_parser', '1.0.1'
|
||||
gem 'git', '1.13.0'
|
||||
gem 'html-proofer', '3.19.4'
|
||||
gem 'mdl', '0.11.0'
|
||||
gem 'octopress-hooks', '2.6.2'
|
||||
gem 'rake', '13.0.6'
|
||||
|
|
23
Gemfile.lock
23
Gemfile.lock
|
@ -10,8 +10,6 @@ GEM
|
|||
em-websocket (0.5.3)
|
||||
eventmachine (>= 0.12.9)
|
||||
http_parser.rb (~> 0)
|
||||
ethon (0.15.0)
|
||||
ffi (>= 1.15.0)
|
||||
eventmachine (1.2.7)
|
||||
ffi (1.15.5)
|
||||
forwardable-extended (2.6.0)
|
||||
|
@ -19,14 +17,6 @@ GEM
|
|||
git (1.13.0)
|
||||
addressable (~> 2.8)
|
||||
rchardet (~> 1.8)
|
||||
html-proofer (3.19.4)
|
||||
addressable (~> 2.3)
|
||||
mercenary (~> 0.3)
|
||||
nokogiri (~> 1.13)
|
||||
parallel (~> 1.10)
|
||||
rainbow (~> 3.0)
|
||||
typhoeus (~> 1.3)
|
||||
yell (~> 2.0)
|
||||
http_parser.rb (0.8.0)
|
||||
i18n (1.12.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
|
@ -75,20 +65,11 @@ GEM
|
|||
tomlrb
|
||||
mixlib-shellout (3.2.7)
|
||||
chef-utils
|
||||
nokogiri (1.14.3-aarch64-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.14.3-arm-linux)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.14.3-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
octopress-hooks (2.6.2)
|
||||
jekyll (>= 2.0)
|
||||
parallel (1.22.1)
|
||||
pathutil (0.16.2)
|
||||
forwardable-extended (~> 2.6)
|
||||
public_suffix (5.0.1)
|
||||
racc (1.6.2)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
rb-fsevent (0.11.2)
|
||||
rb-inotify (0.10.1)
|
||||
|
@ -102,10 +83,7 @@ GEM
|
|||
terminal-table (2.0.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
tomlrb (2.0.3)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
unicode-display_width (1.8.0)
|
||||
yell (2.2.2)
|
||||
|
||||
PLATFORMS
|
||||
aarch64-linux
|
||||
|
@ -115,7 +93,6 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
front_matter_parser (= 1.0.1)
|
||||
git (= 1.13.0)
|
||||
html-proofer (= 3.19.4)
|
||||
jekyll (= 4.2.2)
|
||||
jekyll-redirect-from
|
||||
jekyll-relative-links
|
||||
|
|
|
@ -36,18 +36,18 @@ target "vendor" {
|
|||
}
|
||||
|
||||
group "validate" {
|
||||
targets = ["htmlproofer", "mdl"]
|
||||
targets = ["htmltest", "mdl"]
|
||||
}
|
||||
|
||||
target "htmlproofer" {
|
||||
target "htmltest" {
|
||||
inherits = ["_common"]
|
||||
target = "htmlproofer"
|
||||
target = "htmltest"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "htmlproofer-output" {
|
||||
target "htmltest-output" {
|
||||
inherits = ["_common"]
|
||||
target = "htmlproofer-output"
|
||||
target = "htmltest-output"
|
||||
output = ["./lint"]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue