1 Commits

Author SHA1 Message Date
346a01d6d3 Use categories & redo tags 2022-05-06 22:18:51 -05:00
49 changed files with 66 additions and 680 deletions

View File

@ -2,75 +2,20 @@ name: Audit
on:
push:
branches:
- test1
jobs:
lighthouse:
runs-on: ubuntu-latest
steps:
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
extended: true
- name: Checkout (pull_request)
if: github.event.pull_request
- name: Checkount
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{ github.event.pull_request.base.ref }}
- name: Checkout (push)
if: github.event_name == 'push'
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{ github.event.before }}
- name: Build previous commit
run: |
hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost -d old/
- name: Checkout current commit
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
clean: false
- name: Build current commit
run: |
hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost
cp -r public/ new/
# copy, so that public/ stays, it will be needed for Caddy to serve
- name: Save full diff
run: diff -r old/ new/ | tee changes.diff || true
- name: Upload full diff
uses: actions/upload-artifact@v3
with:
name: diff
path: changes.diff
- name: Find changed URLs
id: changed_urls
env:
SCHEME: https
DOMAIN: localhost
run: |
urls="$(./changed-urls.sh)"
urls="${urls//'%'/'%25'}"
urls="${urls//$'\n'/'%0A'}"
urls="${urls//$'\r'/'%0D'}"
echo "::set-output name=urls::$urls"
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Install Caddy
if: "${{ steps.changed_urls.outputs.urls != '' }}"
run: |
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /etc/apt/trusted.gpg.d/caddy-stable.asc
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
@ -78,12 +23,19 @@ jobs:
sudo apt install caddy
sudo systemctl disable --now caddy
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
extended: true
- name: Build
run: hugo --printI18nWarnings --printPathWarnings --baseURL https://localhost
- name: Compress
if: "${{ steps.changed_urls.outputs.urls != '' }}"
run: time ./compress.sh
- name: Audit using Lighthouse
if: "${{ steps.changed_urls.outputs.urls != '' }}"
uses: treosh/lighthouse-ci-action@v9
with:
uploadArtifacts: true
@ -92,7 +44,6 @@ jobs:
serverBaseUrl: https://lhci.bbaovanc.com/
# this should be safe since it only allows adding (not deleting) data
serverToken: 926a24f2-90e4-48b1-809f-055b9408cf4b
urls: ${{ steps.changed_urls.outputs.urls }}
audit:

View File

@ -1,7 +1,7 @@
name: Pull Request Cleanup
on:
pull_request_target:
pull_request:
types:
- closed

View File

@ -1,8 +0,0 @@
#!/bin/sh
diff -qrN old/ new/ |
grep -oP '(?<=\s)new\/\S*' |
xargs -d '\n' ls -1d 2>/dev/null |
grep 'index.html$' |
sed 's/index.html$//' |
sed "s/^new/${SCHEME:=http}:\/\/${DOMAIN:=example.com}/"

View File

@ -21,8 +21,8 @@ related:
indices:
#- name: keywords
# weight: 100
- name: categories
weight: 80
#- name: categories
# weight: 80
- name: tags
weight: 80
- name: date
@ -44,7 +44,6 @@ params:
# used for "View source" (unset by default)
gitFileURL: https://github.com/BBaoVanC/bbaovanc.com/blob/master
gitFileIcon: code
gitHistoryURL: https://github.com/BBaoVanC/bbaovanc.com/commits/master
# display a "Latest Posts" section on the homepage below its content
homepageLatestPosts: true
@ -56,7 +55,6 @@ params:
linkedin: true
reddit: true
telegram: true
print: true
# show "Latest Posts" section at bottom of content pages
latestPostsOnContent: true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,144 +0,0 @@
---
title: Using GitHub Actions to audit my website with Google Chrome Lighthouse
date: 2022-05-07T00:54:11-05:00
lastmod: 2022-05-07T00:54:11-05:00
toc: true
comments: true
authors:
- bbaovanc
categories:
- devops
- meta
tags:
- caddy
- github-actions
- google-lighthouse
# this will be shown for the article in list pages and in the page metadata
# it can be either an image or video (this might change in the future, however)
resources:
- name: feature
src: dashboard-performance-graph.webp
title: Picture of the `Performance` section on the Lighthouse CI dashboard
- name: youtube-embed-performance-comparison
src: youtube-embed-performance-comparison.webp
title: >-
Performance hit caused by adding a YouTube embed. You can see the
comparison itself [on this comparison
page](https://lhci.bbaovanc.com/app/projects/bbaovanc.com/compare/01d2064b6fac?baseUrl=https%3A%2F%2Flocalhost%2Fblog%2Fthe-redesign-of-my-website%2F&compareUrl=https%3A%2F%2Flocalhost%2Fblog%2Fyoutube-url-structures-you-should-know%2F&baseBuild=01d2064b-6fac-40df-b4e6-373037ae1f9e).
---
The other day I set up automatic testing of my website using [Google Chrome
Lighthouse][google-lighthouse]. I'm also running my own Lighthouse CI server to
store test result history and show trends. Here's an outline of what this means,
some of the results I've obtained so far, and my thoughts on the usefulness of
Lighthouse.
[google-lighthouse]: https://developers.google.com/web/tools/lighthouse
<!--more-->
## What is Lighthouse?
Lighthouse is a tool developed by Google which audits websites and gives them a
score in four categories: *Performance*, *Accessibility*, *Best Practices*, and
*SEO (search engine optimization)*. It's also built into the developer console
in Chrome, so you can run it manually on any website you want directly inside
your browser.
I have already been using Lighthouse manually to do occasional tests on my
website and its theme, [bobatheme][bobatheme]. However, I recently came across
[this GitHub Action][lhci-action]. It caught my eye because I was [already using
GitHub Actions][old-audit-workflow] to perform a few basic Hugo[^hugo]-related
audits found [in a thread on the Hugo forum][hugo-audits-thread].
[^hugo]: [Hugo](https://gohugo.io) is the framework that my website is built on. It's
a static site generator which generates my site according to my own custom
templates that make up my theme.
[bobatheme]: https://github.com/BBaoVanC/bobatheme
[lhci-action]: https://github.com/marketplace/actions/lighthouse-ci-action
[old-audit-workflow]: https://github.com/BBaoVanC/bbaovanc.com/blob/31e25c2578a789afe71ce90352747eb427ca3c0e/.github/workflows/audit.yml#L31-L59
[hugo-audits-thread]: https://discourse.gohugo.io/t/audit-your-published-site-for-problems/35184
## Setting it all up
My goal is to run Lighthouse's audits on an environment as similar to my real
website's deployment as possible.
First, I [created a separate `lighthouse` job on my audit
workflow][lighthouse-actions-job] on GitHub Actions. This job will do all of the
testing. Since it's a separate job, it runs in parallel with my existing audit
task.
[lighthouse-actions-job]: https://github.com/BBaoVanC/bbaovanc.com/blob/3668b6cfb11d09149b5da347219cdc75d0ce0985/.github/workflows/audit.yml#L7
Next, I copied [my existing build steps verbatim][production-build-steps]. This
makes the site effectively identical to my real deployment on bbaovanc.com. One
of the crucial steps is to pre-compress all the files so their compressed
versions can be served without the server having to compress them on-the-fly,
saving valuable processing power.
[production-build-steps]: https://github.com/BBaoVanC/bbaovanc.com/blob/db65e9fc23b840429f5c9ad2b43d7dd01a024f36/.github/workflows/deploy.yml#L22-L33
Serving the compressed files is crucial because it simulates the real world
transfer size of the files. In addition, Lighthouse will recommend that you
serve the files compressed.
Inside the audit environment I use the same webserver (Caddy) and a [similar
configuration][audit-caddy-config] (compared to the [one running on
bbaovanc.com][production-caddy-config]) to what I have running on bbaovanc.com.
Caddy also is able to easily run the demo site with HTTPS, even on localhost.
That allows it to test certain elements (such as the comment section) that
wouldn't be allowed to load if it were plain, unsecured HTTP.
[audit-caddy-config]: https://github.com/BBaoVanC/bbaovanc.com/blob/3668b6cfb11d09149b5da347219cdc75d0ce0985/Caddyfile
[production-caddy-config]: https://git.bbaovanc.com/configs/caddy/src/commit/e3227eb2a2679e27545c2417c2565941f03fb744/conf.d/bbaovanc.com
{{< see-also "/blog/caddy-is-the-best-webserver" >}}
I selected [a few significant pages on my website][lighthouse-urls] so
Lighthouse can test a wide range of the features in my website's theme. The
results of these tests are then uploaded to [my Lighthouse CI
server][lhci-dashboard]. There you can view the audit history and see
differences in results between builds.
[lighthouse-urls]: https://github.com/BBaoVanC/bbaovanc.com/blob/3668b6cfb11d09149b5da347219cdc75d0ce0985/lighthouserc.yaml#L4-L19
[lhci-dashboard]: https://lhci.bbaovanc.com/app/projects/bbaovanc.com/dashboard
## What I found from the tests
### Performance impact of a YouTube video
I found that embedding a YouTube video using the built-in shortcode in Hugo
made the website drastically slower. It's a lot clearer in the audit environment
where everything is throttled down a bunch, so the performance impact is more
clear. Below is a screenshot of the difference in score between my blog post
with a YouTube embed and a similarly sized blog post which has no video.
{{< figure src="youtube-embed-performance-comparison" >}}
I can probably optimize this a little by making a copy of the built-in Hugo
YouTube shortcode, and modifying it to defer the loading of the remote scripts.
That will have to be a future project, and I'll probably write a post if I ever
end up testing it.
## My thoughts on Lighthouse
You can make the argument that the results from Lighthouse don't really mean
much in the real world. On modern devices and a decent internet speed most
websites will load just fine.
Although most pages on my site have a perfect score from Lighthouse, I'm not
going to go way out of my way in order to keep it that way. After all,
Lighthouse is just a tool intended for "improving the quality of web
pages."[^improve-quality-quote] That doesn't mean it needs to be perfect.
[^improve-quality-quote]: Source: [Google
Developers](https://developers.google.com/web/tools/lighthouse)

View File

@ -11,6 +11,7 @@ authors:
categories:
- meta
- newsletter
tags:
- bobanews

View File

@ -12,7 +12,6 @@ authors:
categories:
- linux
- sysadmin
- software
tags:
- caddy

View File

@ -12,9 +12,11 @@ authors:
- bbaovanc
categories:
- github-copilot
tags:
- github-copilot
- copilot
- github
series:
- github-copilot-experiments

View File

@ -13,12 +13,14 @@ aliases:
- posts/edited-in-middle-of-message-discord/
categories:
- discord
- guides
- tips-and-tricks
tags:
- discord
- discord-tricks
- right-to-left-embedding
- rle-character
resources:
- name: feature

View File

@ -1,45 +0,0 @@
---
title: Four
date: 2022-05-09T17:20:17-05:00
lastmod: 2022-05-09T17:20:17-05:00
toc: true
comments: true
draft: true
authors:
- bbaovanc
categories:
- archetype-stuff
tags:
- awesome
series:
- archetype
# this will be shown for the article in list pages and in the page metadata
# it can be either an image or video (this might change in the future, however)
resources:
- name: feature
src: something.webp
title: Some image (image format can be anything; webp is just an example)
---
This page is about something. All the content before the "more" HTML comment
below will become the summary, which will be used in list pages and in the meta
tags on the article.
Or, if you don't want your description to be at the top of the article, you can
set your own `description` in the front matter and it will override this. See
the [Content Summaries](https://gohugo.io/content-management/summaries/) page on
the Hugo docs for more information.
<!--more-->
## Something
All the content below the "more" HTML comment above is part of the article
itself.

View File

@ -10,11 +10,12 @@ authors:
- bbaovanc
categories:
- programming
- tinkering
- github-copilot
tags:
- github-copilot
- copilot
- github
- programming
series:
- github-copilot-experiments

View File

@ -1,44 +0,0 @@
---
title: One
date: 2022-05-09T16:15:55-05:00
lastmod: 2022-05-09T16:15:55-05:00
toc: true
comments: true
authors:
- bbaovanc
categories:
- archetype-stuff
tags:
- awesome
series:
- archetype
# this will be shown for the article in list pages and in the page metadata
# it can be either an image or video (this might change in the future, however)
resources:
- name: feature
src: something.webp
title: Some image (image format can be anything; webp is just an example)
---
This page is about something. All the content before the "more" HTML comment
below will become the summary, which will be used in list pages and in the meta
tags on the article.
Or, if you don't want your description to be at the top of the article, you can
set your own `description` in the front matter and it will override this. See
the [Content Summaries](https://gohugo.io/content-management/summaries/) page on
the Hugo docs for more information.
<!--more-->
## Something
All the content below the "more" HTML comment above is part of the article
itself.

View File

@ -13,10 +13,10 @@ aliases:
- /blog/posts/text-substitution-in-discord-using-sed/
categories:
- discord
- tips-and-tricks
tags:
- discord
- discord-tricks
- sed

View File

@ -10,12 +10,12 @@ authors:
- bbaovanc
categories:
- bobatheme
- meta
tags:
- bobatheme
- hugo
- web-development
- web-design
resources:
- name: feature

View File

@ -1,45 +0,0 @@
---
title: Three
date: 2022-05-09T17:20:16-05:00
lastmod: 2022-05-09T17:20:16-05:00
toc: true
comments: true
draft: true
authors:
- bbaovanc
categories:
- archetype-stuff
tags:
- awesome
series:
- archetype
# this will be shown for the article in list pages and in the page metadata
# it can be either an image or video (this might change in the future, however)
resources:
- name: feature
src: something.webp
title: Some image (image format can be anything; webp is just an example)
---
This page is about something. All the content before the "more" HTML comment
below will become the summary, which will be used in list pages and in the meta
tags on the article.
Or, if you don't want your description to be at the top of the article, you can
set your own `description` in the front matter and it will override this. See
the [Content Summaries](https://gohugo.io/content-management/summaries/) page on
the Hugo docs for more information.
<!--more-->
## Something
All the content below the "more" HTML comment above is part of the article
itself.

View File

@ -1,45 +0,0 @@
---
title: Two
date: 2022-05-09T17:20:15-05:00
lastmod: 2022-05-09T17:20:15-05:00
toc: true
comments: true
draft: true
authors:
- bbaovanc
categories:
- archetype-stuff
tags:
- awesome
series:
- archetype
# this will be shown for the article in list pages and in the page metadata
# it can be either an image or video (this might change in the future, however)
resources:
- name: feature
src: something.webp
title: Some image (image format can be anything; webp is just an example)
---
This page is about something. All the content before the "more" HTML comment
below will become the summary, which will be used in list pages and in the meta
tags on the article.
Or, if you don't want your description to be at the top of the article, you can
set your own `description` in the front matter and it will override this. See
the [Content Summaries](https://gohugo.io/content-management/summaries/) page on
the Hugo docs for more information.
<!--more-->
## Something
All the content below the "more" HTML comment above is part of the article
itself.

View File

@ -10,9 +10,11 @@ authors:
- bbaovanc
categories:
- github-copilot
tags:
- github-copilot
- copilot
- github
- markdown
series:

View File

@ -10,11 +10,10 @@ authors:
- bbaovanc
categories:
- tips-and-tricks
- url-structures
tags:
- query-parameters
- url-structures
- youtube
resources:

View File

@ -1,11 +0,0 @@
---
title: DevOps
---
Posts about toolchain and software pipeline stuff. The abbreviation means
software development (Dev) plus IT operations (Ops). Includes things such as
CI/CD (GitHub Actions).
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Programming
---
Any posts relating to programming and/or software development.
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Software
---
Posts that discuss/review various programs.
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Tinkering
---
Posts where I experiment with things.
<!--more-->

View File

@ -2,9 +2,8 @@
title: Github Copilot Experiments
description: >-
Make sure to read the last two posts where I made GitHub Copilot write a blog
post itself.
---
Make sure to read the last two posts where I made GitHub Copilot write a blog
post itself.
<!--more-->

View File

@ -1,10 +0,0 @@
---
title: Arch Linux
---
A Linux distribution which aims to be lightweight, flexible, and simple. See
https://archlinux.org for more information.
<!--more-->

View File

@ -1,12 +0,0 @@
---
title: bobanews
---
The main name for my newsletter. I recommend you read the [blog post I wrote
about it][newsletter-post].
[newsletter-post]: {{< ref "/blog/blog-post-newsletter" >}}
<!--more-->

View File

@ -1,14 +0,0 @@
---
title: Caddy
---
Caddy is a powerful and open source webserver written in [Golang][golang] which
includes some fancy features such as built-in automatic HTTPS. It's by far my
favorite webserver. See my [blog post about Caddy][caddy-blog-post] for why.
[golang]: https://go.dev/
[caddy-blog-post]: {{< ref "/blog/caddy-is-the-best-webserver" >}}
<!--more-->

View File

@ -1,13 +0,0 @@
---
title: checkra1n
---
An [iOS jailbreak][ios-jailbreaking] which supports the iPhone 4s to the iPhone
X. See the [official checkra1n website][checkra1n-website] for more information.
[ios-jailbreaking]: https://en.wikipedia.org/wiki/IOS_jailbreaking
[checkra1n-website]: https://checkra.in/
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Discord Tricks
---
Tips and tricks I have learned about Discord.
<!--more-->

View File

@ -1,13 +0,0 @@
---
title: Gitea
---
Gitea is a lightweight self-hosted Git service similar to GitHub. I use it on
[bbaovanc's Gitea][bbaovanc-gitea] and [bobatea][bobatea].
[bbaovanc-gitea]: https://git.bbaovanc.com
[bobatea]: https://git.boba.best
<!--more-->

View File

@ -1,11 +0,0 @@
---
title: Github Actions
---
Any posts that talk about GitHub's CI/CD platform. This is what I use for
automatic tasks on my website, such as automatic audits, and automatic building
and deploying.
<!--more-->

View File

@ -1,11 +0,0 @@
---
title: Google Lighthouse
---
Lighthouse is a tool that can audit websites based on performance,
accessibility, SEO, and more. It also provides useful suggestions on how a
website can be improved.
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Hugo
---
Hugo is a static site generator which I use to generate this website.
<!--more-->

View File

@ -1,12 +0,0 @@
---
title: listmonk
---
A self-hosted newsletter manager which I use to handle my blog post newsletter.
Read [this blog post][newsletter-blog-post] for more information.
[newsletter-blog-post]: {{< ref "/blog/blog-post-newsletter" >}}
<!--more-->

View File

@ -1,11 +0,0 @@
---
title: Markdown
---
Markdown is a simple and easy to use markup language which is actually used to
write the content on this website. Writing it only requires learning a very
basis syntax, and using a plain-text editor.
<!--more-->

View File

@ -1,11 +0,0 @@
---
title: sed
---
Short for "stream editor", `sed` is a utility used to edit text on Unix systems.
It is usually used with regular expressions (regex for short). If you're
interested, look up "regex basics" and "sed basics", or something similar.
<!--more-->

View File

@ -1,10 +0,0 @@
---
title: systemd
---
`systemd` is by far the most popular service manager (known as an "init system")
used on Linux.
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Web Development
---
Posts about developing for the internet.
<!--more-->

View File

@ -1,9 +0,0 @@
---
title: Webserver
---
Blog posts about webservers (software that runs websites).
<!--more-->

View File

@ -1,10 +0,0 @@
---
title: YouTube
---
One of the most popular video and social media platforms. If you don't know what
YouTube is, I don't know what to tell you.
<!--more-->

View File

@ -3,20 +3,18 @@
-->
<style>
#isso-thread > h4 {
color: var(--text-1);
margin-bottom: 8px;
color: var(--text-normal);
}
#isso-root .isso-comment:not(:first-of-type),
.isso-follow-up .isso-comment {
border-color: var(--background-highlight);
border-color: var(--background-4);
}
.isso-comment > .isso-text-wrapper > .isso-comment-header .isso-author,
.isso-comment > .isso-text-wrapper > .isso-comment-header .isso-page-author-suffix,
.isso-comment > .isso-text-wrapper > .isso-comment-footer,
.isso-comment > .isso-text-wrapper > .isso-comment-footer .isso-votes {
color: var(--text-1);
color: var(--text-normal);
opacity: 80%;
}
@ -28,8 +26,8 @@
}
.isso-postbox > .isso-form-wrapper .isso-preview {
color: var(--text-1);
background: var(--background-1);
color: var(--text-normal);
background: var(--background-2);
}
.isso-comment > .isso-text-wrapper > .isso-comment-footer a,
@ -45,56 +43,16 @@
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-post-action > input,
#isso-thread .isso-textarea,
.isso-postbox > .isso-form-wrapper .isso-preview {
color: var(--text-1);
background-color: var(--background-1);
border-color: var(--background-2) !important;
color: var(--text-normal);
background-color: var(--background-2);
border-color: var(--background-4) !important;
}
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-post-action > input:hover {
background-color: var(--background-2);
background-color: var(--background-4);
}
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-post-action > input:active {
background-color: var(--background-highlight);
}
#isso-thread .isso-textarea {
margin-bottom: 4px;
}
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-input-wrapper {
display: inline-flex;
flex-direction: column;
margin-right: 4px;
}
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-input-wrapper input {
order: 1;
}
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-input-wrapper label {
order: 2;
font-size: small;
}
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-post-action {
margin-left: 4px;
margin-top: 0;
}
@media screen and (max-width: 600px) {
.isso-postbox > .isso-form-wrapper > .isso-auth-section .isso-input-wrapper {
display: block;
margin-right: 0;
}
}
@media print {
.comments {
break-before: always;
}
.isso-comment > .isso-text-wrapper {
break-inside: avoid;
}
.isso-postbox,
.isso-feedlink {
display: none;
}
background-color: var(--background-5);
}
</style>
@ -133,7 +91,7 @@
{{/*
data-isso-vote-levels=""
*/}}
data-isso-feed="true"
data-isso-feed="false"
data-isso-require-email="false"
data-isso-reply-notifications="true"
data-isso-reply-notifications-default-enabled="true"

View File

@ -1,5 +1,22 @@
ci:
collect:
url:
- https://localhost/ # homepage
- https://localhost/links/ # very simple page
- https://localhost/blog/ # list page
- https://localhost/blog/the-redesign-of-my-website/ # average post, but no footnotes
- https://localhost/blog/blog-post-newsletter/ # average post, but WITH footnotes
- https://localhost/blog/caddy-is-the-best-webserver/ # another average post with footnotes, WITH code blocks
- https://localhost/blog/youtube-url-structures-you-should-know/ # youtube embed
- https://localhost/blog/copilot-post/ # lots of code blocks & text
- https://localhost/blog/github-copilot-experiments/ # heavy use of images
- https://localhost/categories/
- https://localhost/categories/github-copilot/
- https://localhost/tags/
- https://localhost/tags/discord-tricks/
startServerCommand: sudo caddy run
settings:
chromeFlags: "--ignore-certificate-errors --throttling.cpuSlowdownMultiplier=2.4"