add lighthouse-ci to drone

This commit is contained in:
Robert Kaussow 2020-06-01 15:59:02 +02:00
parent e361563626
commit 178b92b0a0
11 changed files with 69 additions and 22 deletions

View File

@ -21,7 +21,7 @@ steps:
image: klakegg/hugo:0.69.0-ext-alpine image: klakegg/hugo:0.69.0-ext-alpine
commands: commands:
- cd exampleSite/ - cd exampleSite/
- mkdir themes/ && ln -s ../../. themes/hugo-geekdoc && hugo-official - mkdir themes/ && ln -s ../../. themes/hugo-geekdoc && hugo-official -b http://localhost/
- name: spellcheck - name: spellcheck
image: node:lts-alpine image: node:lts-alpine
@ -44,12 +44,18 @@ steps:
environment: environment:
LINK_VALIDATOR_BASE_DIR: /drone/src/exampleSite/public LINK_VALIDATOR_BASE_DIR: /drone/src/exampleSite/public
- name: page-validator
image: patrickhulce/lhci-client
user: root
commands:
- lhci autorun
- name: build - name: build
image: alpine image: alpine
commands: commands:
- mkdir dist/ - mkdir dist/
- echo "${DRONE_TAG:-latest}" > VERSION - echo "${DRONE_TAG:-latest}" > VERSION
- tar -zcvf dist/hugo-geekdoc.tar.gz . --exclude='.git*' --exclude='.drone*' --exclude='dist' --exclude='.git*' --exclude='example*' --exclude='src' --exclude='gulp*' --exclude='package*' --exclude='node*' --exclude='local*' - tar -zcvf dist/hugo-geekdoc.tar.gz -X .tarignore .
- name: checksum - name: checksum
image: alpine image: alpine
@ -162,6 +168,6 @@ depends_on:
--- ---
kind: signature kind: signature
hmac: ca1ffdbbe56ee6624fad160c24071dcd3da2de55d580c3614dd0e6a23cdb338a hmac: 6c9fc660b81ed9086e1bcb0f8176ba6b084834bc7ecafbaa0573943760698330
... ...

4
.gitignore vendored
View File

@ -1,6 +1,7 @@
# local environments # local environments
.swp .swp
.env* .env*
dist/
node_modules/ node_modules/
exampleSite/themes/ exampleSite/themes/
exampleSite/public/ exampleSite/public/
@ -10,3 +11,6 @@ layouts/partials/icons-svg-symbols.html
static/main.* static/main.*
static/favicon/ static/favicon/
resources/_gen/ resources/_gen/
# testing
.lighthouseci/

17
.lighthouserc.yml Normal file
View File

@ -0,0 +1,17 @@
---
ci:
collect:
numberOfRuns: 2
staticDistDir: exampleSite/public
url:
- http://localhost/
- http://localhost/404.html
- http://localhost/posts/
settings:
chromeFlags: "--no-sandbox"
assert:
preset: "lighthouse:no-pwa"
assertions:
uses-long-cache-ttl: off
render-blocking-resources: off
tap-targets: off

13
.tarignore Normal file
View File

@ -0,0 +1,13 @@
.tarignore
.dictionary*
.git*
.drone*
.lighthouse*
.markdownlint*
example*
gulp*
package*
node*
local*
dist
src

View File

@ -3,9 +3,9 @@
{{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }} {{ $.Scratch.Set "content" (.Content | replaceRE `<nav id="TableOfContents">\s*<ul>\s*<li>\s*<ul>` `<nav id="TableOfContents"><ul>` | replaceRE `</ul>\s*</li>\s*</ul>\s*</nav>` `</ul></nav>` | safeHTML) }}
{{ if and $showAnchor $anchorLeft }} {{ if and $showAnchor $anchorLeft }}
{{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--left clip" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s%s</div>` `${1}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${2}` `${3}` `${4}`) | safeHTML) }} {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--left clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s%s</div>` `${1}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${3}` `${4}`) | safeHTML) }}
{{ else if and $showAnchor (not $anchorLeft) }} {{ else if and $showAnchor (not $anchorLeft) }}
{{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--right clip" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s</div>` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${2}` `${4}`) | safeHTML) }} {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(<h[2-9] id=\"([^\"]+)\"[^>]*>)(.*?)(</h[2-9]+>)" (printf `<div class="gdoc-page__anchorwrap">%s%s<a data-clipboard-text="%s" class="gdoc-page__anchor gdoc-page__anchor--right clip" aria-label="Anchor %s" href="#%s"><svg class="icon link"><use xlink:href="#link"></use></svg></a>%s</div>` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${4}`) | safeHTML) }}
{{ end }} {{ end }}
{{ $.Scratch.Get "content" }} {{ $.Scratch.Get "content" }}

View File

@ -7,8 +7,10 @@
{{ end }} {{ end }}
{{ if default true .Site.Params.GeekdocAnchorCopy }} {{ if default true .Site.Params.GeekdocAnchorCopy }}
<script src="{{ "js/clipboard.min.js" | relURL }}"></script> <script defer src="{{ "js/clipboard.min.js" | relURL }}"></script>
<script> <script>
document.addEventListener("DOMContentLoaded", function(event) {
var clipboard = new ClipboardJS('.clip'); var clipboard = new ClipboardJS('.clip');
});
</script> </script>
{{ end }} {{ end }}

View File

@ -5,9 +5,9 @@
<title>{{ partial "title" . }} | {{ .Site.Title -}}</title> <title>{{ partial "title" . }} | {{ .Site.Title -}}</title>
<link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon"> <link rel="icon" href="{{ "favicon/favicon-32x32.png" | relURL }}" type="image/x-icon">
<link rel="stylesheet" href="{{ "main.min.css" | relURL }}"> <link rel="stylesheet" href="{{ "main.min.css" | relURL }}" media="screen">
<!-- Theme stylesheet, you can customize css by creating static/custom.css` in your website --> <!-- Theme stylesheet, you can customize css by creating static/custom.css` in your website -->
<link rel="stylesheet" href="{{ "custom.css" | relURL }}"> <link rel="stylesheet" href="{{ "custom.css" | relURL }}" media="screen">
<!-- RSS --> <!-- RSS -->
{{ with .OutputFormats.Get "rss" -}} {{ with .OutputFormats.Get "rss" -}}

View File

@ -6,15 +6,13 @@
<h1 class="gdoc-post__title"> <h1 class="gdoc-post__title">
<a href="{{ .RelPermalink }}">{{ .Title }}</a> <a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h1> </h1>
<div class="gdoc-post__date">{{ .Date.Format $dateFormat }}</div>
</header> </header>
<h5>
<strong>{{ .Date.Format $dateFormat }}</strong>
</h5>
<div> <div>
{{ .Summary }} {{ .Summary }}
{{ if .Truncated }} {{ if .Truncated }}
<a class="gdoc-post__readmore" title="Read full post" href="{{ .RelPermalink }}"> <a class="gdoc-post__readmore" title="Read full post" href="{{ .RelPermalink }}">
Read more Read full post
</a> </a>
{{ end }} {{ end }}
</div> </div>

View File

@ -1,10 +1,12 @@
{{ define "main" }} {{ define "main" }}
{{ $dateFormat := default "January 2, 2006" .Site.Params.GeekdocDateFormat }} {{ $dateFormat := default "January 2, 2006" .Site.Params.GeekdocDateFormat }}
<article class="gdoc-markdown"> <article class="gdoc-markdown gdoc-post">
<h1>{{ .Title }}</h1> <header>
<h5> <h1 class="gdoc-post__title">{{ .Title }}</h1>
<strong>{{ .Date.Format $dateFormat }}</strong> <div class="gdoc-post__date">{{ .Date.Format $dateFormat }}</div>
</h5> </header>
<div>
{{ partial "content" . }} {{ partial "content" . }}
</div>
</article> </article>
{{ end }} {{ end }}

View File

@ -1,7 +1,7 @@
{{ if not (.Page.Scratch.Get "mermaid") }} {{ if not (.Page.Scratch.Get "mermaid") }}
<!-- Include mermaid only first time --> <!-- Include mermaid only first time -->
<script src="{{ "js/mermaid.min.js" | relURL }}"></script> <script defer src="{{ "js/mermaid.min.js" | relURL }}"></script>
<script> <script defer>
mermaid.initialize({ mermaid.initialize({
flowchart: { useMaxWidth: true } flowchart: { useMaxWidth: true }
}); });

View File

@ -286,16 +286,21 @@ img {
} }
} }
&__date {
font-weight: bold;
margin: 1em 0;
}
&:first-child { &:first-child {
border-top: 0; border-top: 0;
h1 { h1 {
margin: 0; margin-top: 0;
} }
} }
&__readmore { &__readmore {
margin: 1em 0; margin-top: 1em;
color: $color-link; color: $color-link;
display: block; display: block;