From 178b92b0a05f26746497e296185e79c711a044d6 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 1 Jun 2020 15:59:02 +0200 Subject: [PATCH] add lighthouse-ci to drone --- .drone.yml | 12 +++++++++--- .gitignore | 4 ++++ .lighthouserc.yml | 17 +++++++++++++++++ .tarignore | 13 +++++++++++++ layouts/partials/content.html | 4 ++-- layouts/partials/foot.html | 6 ++++-- layouts/partials/head.html | 4 ++-- layouts/posts/list.html | 6 ++---- layouts/posts/single.html | 12 +++++++----- layouts/shortcodes/mermaid.html | 4 ++-- src/sass/_base.scss | 9 +++++++-- 11 files changed, 69 insertions(+), 22 deletions(-) create mode 100644 .lighthouserc.yml create mode 100644 .tarignore diff --git a/.drone.yml b/.drone.yml index f1cba01..237b144 100644 --- a/.drone.yml +++ b/.drone.yml @@ -21,7 +21,7 @@ steps: image: klakegg/hugo:0.69.0-ext-alpine commands: - 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 image: node:lts-alpine @@ -44,12 +44,18 @@ steps: environment: LINK_VALIDATOR_BASE_DIR: /drone/src/exampleSite/public +- name: page-validator + image: patrickhulce/lhci-client + user: root + commands: + - lhci autorun + - name: build image: alpine commands: - mkdir dist/ - 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 image: alpine @@ -162,6 +168,6 @@ depends_on: --- kind: signature -hmac: ca1ffdbbe56ee6624fad160c24071dcd3da2de55d580c3614dd0e6a23cdb338a +hmac: 6c9fc660b81ed9086e1bcb0f8176ba6b084834bc7ecafbaa0573943760698330 ... diff --git a/.gitignore b/.gitignore index 2af3041..bbfc527 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ # local environments .swp .env* +dist/ node_modules/ exampleSite/themes/ exampleSite/public/ @@ -10,3 +11,6 @@ layouts/partials/icons-svg-symbols.html static/main.* static/favicon/ resources/_gen/ + +# testing +.lighthouseci/ diff --git a/.lighthouserc.yml b/.lighthouserc.yml new file mode 100644 index 0000000..10525f6 --- /dev/null +++ b/.lighthouserc.yml @@ -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 diff --git a/.tarignore b/.tarignore new file mode 100644 index 0000000..16cdb49 --- /dev/null +++ b/.tarignore @@ -0,0 +1,13 @@ +.tarignore +.dictionary* +.git* +.drone* +.lighthouse* +.markdownlint* +example* +gulp* +package* +node* +local* +dist +src diff --git a/layouts/partials/content.html b/layouts/partials/content.html index f9d10d7..f7904b6 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -3,9 +3,9 @@ {{ $.Scratch.Set "content" (.Content | replaceRE `` `` | safeHTML) }} {{ if and $showAnchor $anchorLeft }} - {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" (printf `
%s%s%s
` `${1}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${2}` `${3}` `${4}`) | safeHTML) }} + {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" (printf `
%s%s%s
` `${1}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${3}` `${4}`) | safeHTML) }} {{ else if and $showAnchor (not $anchorLeft) }} - {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" (printf `
%s%s%s
` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${2}` `${4}`) | safeHTML) }} + {{ $.Scratch.Set "content" ($.Scratch.Get "content" | replaceRE "(]*>)(.*?)()" (printf `
%s%s%s
` `${1}` `${3}` (absURL (printf "%s#%s" .Permalink `${2}`)) `${3}` `${2}` `${4}`) | safeHTML) }} {{ end }} {{ $.Scratch.Get "content" }} diff --git a/layouts/partials/foot.html b/layouts/partials/foot.html index cc5506b..5805bbb 100644 --- a/layouts/partials/foot.html +++ b/layouts/partials/foot.html @@ -7,8 +7,10 @@ {{ end }} {{ if default true .Site.Params.GeekdocAnchorCopy }} - + {{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 2d10cde..ac35c60 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -5,9 +5,9 @@ {{ partial "title" . }} | {{ .Site.Title -}} - + - + {{ with .OutputFormats.Get "rss" -}} diff --git a/layouts/posts/list.html b/layouts/posts/list.html index f197591..33ff7ab 100644 --- a/layouts/posts/list.html +++ b/layouts/posts/list.html @@ -6,15 +6,13 @@

{{ .Title }}

+ -
- {{ .Date.Format $dateFormat }} -
{{ .Summary }} {{ if .Truncated }} - Read more + Read full post {{ end }}
diff --git a/layouts/posts/single.html b/layouts/posts/single.html index e4e390e..2ecc822 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -1,10 +1,12 @@ {{ define "main" }} {{ $dateFormat := default "January 2, 2006" .Site.Params.GeekdocDateFormat }} -
-

{{ .Title }}

-
- {{ .Date.Format $dateFormat }} -
+
+
+

{{ .Title }}

+ +
+
{{ partial "content" . }} +
{{ end }} diff --git a/layouts/shortcodes/mermaid.html b/layouts/shortcodes/mermaid.html index d144c6a..de129ec 100644 --- a/layouts/shortcodes/mermaid.html +++ b/layouts/shortcodes/mermaid.html @@ -1,7 +1,7 @@ {{ if not (.Page.Scratch.Get "mermaid") }} - - +