Skip to content

Commit 2d44be0

Browse files
author
David Karlsson
committed
ci: replace htmlproofer with wjdp/htmltest
Signed-off-by: David Karlsson <[email protected]>
1 parent 27485b9 commit 2d44be0

File tree

7 files changed

+39
-47
lines changed

7 files changed

+39
-47
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: false
3636
matrix:
3737
target:
38-
- htmlproofer
38+
- htmltest
3939
- mdl
4040
steps:
4141
-
@@ -70,7 +70,7 @@ jobs:
7070
7171
// construct annotations by parsing output
7272
switch ("${{ matrix.target }}") {
73-
case "htmlproofer":
73+
case "htmltest":
7474
const re = /^- (.+)\n \* (.+) \(line (\d+)\)\n(.+)$/gm;
7575
while (true) {
7676
const result = re.exec(results);
@@ -79,7 +79,7 @@ jobs:
7979
}
8080
8181
core.error(`${result[2]}\n${result[4]}`, {
82-
title: 'Link check failed',
82+
title: 'HTML test failed',
8383
// file: result[1],
8484
// startLine: result[3],
8585
});

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ CNAME
1010
_kbase/**
1111
/vendor
1212
/lint
13+
tmp/.htmltest/**

.htmltest.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
DirectoryPath: "_site"
2+
EnforceHTTPS: false
3+
CheckDoctype: false
4+
CheckExternal: false
5+
IgnoreAltMissing: true
6+
IgnoreAltEmpty: true
7+
IgnoreEmptyHref: true
8+
IgnoreDirectoryMissingTrailingSlash: true
9+
IgnoreURLs:
10+
- "^/docker-hub/api/latest/.*$"
11+
- "^/engine/api/v.+/#.*$"
12+
- "^/glossary/.*$"
13+
IgnoreDirs:
14+
- "engine/api"
15+
- "registry/configuration"
16+
CacheExpires: "6h"

Dockerfile

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,27 @@ RUN --mount=type=bind,target=.,rw \
6363
bundle exec jekyll build --profile -d ${TARGET} --config ${CONFIG_FILES}
6464
EOT
6565

66-
# htmlproofer checks for broken links
67-
FROM gem AS htmlproofer-base
68-
RUN --mount=type=bind,from=generate,source=/out,target=_site <<EOF
69-
htmlproofer ./_site \
70-
--disable-external \
71-
--internal-domains="docs.docker.com,docs-stage.docker.com,localhost:4000" \
72-
--file-ignore="/^./_site/engine/api/.*$/,./_site/registry/configuration/index.html" \
73-
--url-ignore="/^/docker-hub/api/latest/.*$/,/^/engine/api/v.+/#.*$/,/^/glossary/.*$/" > /results 2>&1
74-
rc=$?
75-
if [[ $rc -eq 0 ]]; then
76-
echo -n > /results
77-
fi
66+
# htmltest checks for broken links
67+
FROM wjdp/htmltest:v0.17.0 as htmltest-base
68+
RUN --mount=type=bind,from=generate,source=/out,target=_site \
69+
--mount=type=bind,source=.htmltest.yml,target=.htmltest.yml \
70+
<<EOF
71+
htmltest > /results 2>&1
72+
rc=$?
73+
if [[ $rc -eq 0 ]]; then
74+
echo -n > /results
75+
fi
7876
EOF
7977

80-
FROM htmlproofer-base as htmlproofer
78+
FROM base as htmltest
79+
COPY --from=htmltest-base /results /results
8180
RUN <<EOF
8281
cat /results
8382
[ ! -s /results ] || exit 1
8483
EOF
8584

86-
FROM scratch as htmlproofer-output
87-
COPY --from=htmlproofer-base /results /results
85+
FROM scratch as htmltest-output
86+
COPY --from=htmltest-base /results /results
8887

8988
# mdl is a lint tool for markdown files
9089
FROM gem AS mdl-base

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ gem 'rouge', '3.27.0'
1717

1818
gem 'front_matter_parser', '1.0.1'
1919
gem 'git', '1.13.0'
20-
gem 'html-proofer', '3.19.4'
2120
gem 'mdl', '0.11.0'
2221
gem 'octopress-hooks', '2.6.2'
2322
gem 'rake', '13.0.6'

Gemfile.lock

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,13 @@ GEM
1010
em-websocket (0.5.3)
1111
eventmachine (>= 0.12.9)
1212
http_parser.rb (~> 0)
13-
ethon (0.15.0)
14-
ffi (>= 1.15.0)
1513
eventmachine (1.2.7)
1614
ffi (1.15.5)
1715
forwardable-extended (2.6.0)
1816
front_matter_parser (1.0.1)
1917
git (1.13.0)
2018
addressable (~> 2.8)
2119
rchardet (~> 1.8)
22-
html-proofer (3.19.4)
23-
addressable (~> 2.3)
24-
mercenary (~> 0.3)
25-
nokogiri (~> 1.13)
26-
parallel (~> 1.10)
27-
rainbow (~> 3.0)
28-
typhoeus (~> 1.3)
29-
yell (~> 2.0)
3020
http_parser.rb (0.8.0)
3121
i18n (1.12.0)
3222
concurrent-ruby (~> 1.0)
@@ -75,20 +65,11 @@ GEM
7565
tomlrb
7666
mixlib-shellout (3.2.7)
7767
chef-utils
78-
nokogiri (1.14.3-aarch64-linux)
79-
racc (~> 1.4)
80-
nokogiri (1.14.3-arm-linux)
81-
racc (~> 1.4)
82-
nokogiri (1.14.3-x86_64-linux)
83-
racc (~> 1.4)
8468
octopress-hooks (2.6.2)
8569
jekyll (>= 2.0)
86-
parallel (1.22.1)
8770
pathutil (0.16.2)
8871
forwardable-extended (~> 2.6)
8972
public_suffix (5.0.1)
90-
racc (1.6.2)
91-
rainbow (3.1.1)
9273
rake (13.0.6)
9374
rb-fsevent (0.11.2)
9475
rb-inotify (0.10.1)
@@ -102,10 +83,7 @@ GEM
10283
terminal-table (2.0.0)
10384
unicode-display_width (~> 1.1, >= 1.1.1)
10485
tomlrb (2.0.3)
105-
typhoeus (1.4.0)
106-
ethon (>= 0.9.0)
10786
unicode-display_width (1.8.0)
108-
yell (2.2.2)
10987

11088
PLATFORMS
11189
aarch64-linux
@@ -115,7 +93,6 @@ PLATFORMS
11593
DEPENDENCIES
11694
front_matter_parser (= 1.0.1)
11795
git (= 1.13.0)
118-
html-proofer (= 3.19.4)
11996
jekyll (= 4.2.2)
12097
jekyll-redirect-from
12198
jekyll-relative-links

docker-bake.hcl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,18 @@ target "vendor" {
3636
}
3737

3838
group "validate" {
39-
targets = ["htmlproofer", "mdl"]
39+
targets = ["htmltest", "mdl"]
4040
}
4141

42-
target "htmlproofer" {
42+
target "htmltest" {
4343
inherits = ["_common"]
44-
target = "htmlproofer"
44+
target = "htmltest"
4545
output = ["type=cacheonly"]
4646
}
4747

48-
target "htmlproofer-output" {
48+
target "htmltest-output" {
4949
inherits = ["_common"]
50-
target = "htmlproofer-output"
50+
target = "htmltest-output"
5151
output = ["./lint"]
5252
}
5353

0 commit comments

Comments
 (0)