Browse Source

feat(feature/code-analysis): add source build of htmltest

re #124, re #165
Josh Habdas 1 week ago
parent
commit
1cd1d6c3f9
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74

+ 48
- 0
docker/htmltest/Dockerfile View File

@@ -0,0 +1,48 @@
1
+#
2
+# Copyright (C) 2019  Josh Habdas <jhabdas@protonmail.com>
3
+#
4
+# This file is part of After Dark.
5
+#
6
+# After Dark is free software: you can redistribute it and/or modify
7
+# it under the terms of the GNU Affero General Public License as published
8
+# by the Free Software Foundation, either version 3 of the License, or
9
+# (at your option) any later version.
10
+#
11
+# After Dark is distributed in the hope that it will be useful,
12
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
+# GNU Affero General Public License for more details.
15
+#
16
+# You should have received a copy of the GNU Affero General Public License
17
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
+#
19
+
20
+# DOCKER-VERSION 19.03.1-ce, build 74b1e89e8a
21
+
22
+# Specify build image
23
+ARG GO_VERSION=1.11.4
24
+ARG BUILD_TARGET=alpine3.8
25
+
26
+# Pull builder base image
27
+FROM golang:${GO_VERSION}-${BUILD_TARGET} AS htmltestbuilder
28
+
29
+# Set build variables
30
+ARG HTMLTEST_VERSION=0.10.3
31
+ENV CGO_ENABLED=0 \
32
+    GOOS=linux \
33
+    GO111MODULE=on
34
+
35
+# Build from source using specified version
36
+RUN \
37
+  apk add --update --no-cache ca-certificates git musl-dev && \
38
+  git clone https://github.com/wjdp/htmltest.git $GOPATH/src/github.com/wjdp/htmltest && \
39
+  cd ${GOPATH:-$HOME/go}/src/github.com/wjdp/htmltest && \
40
+  git checkout v$HTMLTEST_VERSION && \
41
+  go mod download && \
42
+  go install -installsuffix 'static' -ldflags "-X main.date=`date -u +%Y-%m-%dT%H:%M:%SZ` -X main.version=`git describe --tags`"
43
+
44
+# Move compiled binary into own container
45
+FROM scratch
46
+COPY --from=htmltestbuilder /go/bin/htmltest /htmltest
47
+ENTRYPOINT ["/htmltest"]
48
+CMD ["-h"]

+ 1
- 1
docs/config/_default/config.toml View File

@@ -19,7 +19,7 @@
19 19
 
20 20
 baseurl = "https://after-dark.habd.as/" # Controls base URL sitewide
21 21
 title = "After Dark" # Homepage title and page title suffix
22
-paginate = 39 # Number of items to show before paginating
22
+paginate = 40 # Number of items to show before paginating
23 23
 copyright = "Copyright &copy; Josh Habdas. Licensed under <a target=\"_blank\" rel=\"external noopener license\" href=\"https://www.gnu.org/licenses/agpl.html\">AGPL-3.0-or-later</a>."
24 24
 
25 25
 # Controls default theme and theme components

+ 35
- 0
docs/content/feature/code-analysis.md View File

@@ -0,0 +1,35 @@
1
++++
2
+title = "Code Analysis"
3
+description = "Test generated website HTML for problems."
4
+categories = ["experience"]
5
+tags = ["docker", "container", "cloud", "ci", "go", "robots"]
6
+features = ["code highlighter", "related content", "snippets"]
7
+[[copyright]]
8
+  owner = "Josh Habdas"
9
+  date = "2019"
10
+  license = "agpl-3.0-or-later"
11
++++
12
+
13
+After Dark includes a source build of {{< external "https://github.com/wjdp/htmltest" "htmltest" />}} which may be used to analyze HTML generated for problems such as linkrot, meta attributes and more.
14
+
15
+Code analysis is ideal for identifying potential 404 errors and determining when to link to the archived version of an external page which has gone offline.
16
+
17
+To use install Docker then run the following command:
18
+
19
+```sh
20
+cd after-dark/docker/htmltest && docker build .
21
+```
22
+
23
+Build container uses Alpine and includes `musl-dev` for high-performance. Update the `HTMLTEST_VERSION` to get a specific release built. Upon successful build extract the resulting binary out of the scratch container like:
24
+
25
+```
26
+docker create -it --name temp f2b785583ce8 sh && \
27
+sudo docker cp temp:/hugo /usr/local/bin && \
28
+docker rm -fv temp
29
+```
30
+
31
+Where `f2b785583ce8` is the scratch container’s Image ID and `/usr/local/bin` is the destination on the host. Place executable in most appropriate directory.
32
+
33
+If using Hugo `0.56.x` or higher may also possible to include `htmltest` as a Go module using {{< external "https://gohugo.io/hugo-modules/" "Hugo Modules" />}} if your particular use case calls for it.
34
+
35
+See {{< external "https://github.com/wjdp/htmltest" "htmltest" />}} for documentation and usage.

+ 1
- 1
docs/content/feature/extended-builds.md View File

@@ -2,7 +2,7 @@
2 2
 title = "Extended Builds"
3 3
 description = "Build Hugo with Sass and Go CDK Deploy support."
4 4
 categories = ["core"]
5
-tags = ["docker", "container", "sass", "cloud"]
5
+tags = ["docker", "container", "sass", "cloud", "ci"]
6 6
 features = ["code highlighter", "related content"]
7 7
 [[copyright]]
8 8
   owner = "Josh Habdas"

+ 1
- 1
docs/layouts/index.html View File

@@ -69,7 +69,7 @@ along with this program.  If not, see <https://www.gnu.org/licenses/>.
69 69
             <th scope="col" width="25%">Extras</th>
70 70
           </tr>
71 71
           <tr>
72
-            <td><a href="./feature/">39</a></td>
72
+            <td><a href="./feature/">40</a></td>
73 73
             <td><a href="./module/">4</a></td>
74 74
             <td><a href="./shortcode/">27+</a></td>
75 75
             <td><a href="./extra/">2</a></td>

Loading…
Cancel
Save