1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-11-10 00:12:09 +00:00

IndieWeb: gather WebWentions with static-webmention

Update the Makefile to download the old version of the site, run
static-webmentions, and collect the WebMentions to send in a json file
saved as a build artifact.

Don't send these automatically; just save them for now. Until I work out
a solution to save sent WebMentions and avoid sending duplicates, I'll
keep the sending of WebMentions manual.

For some reason this caused webhint's axe/aria test to error out with a
"Protocol error" so I disabled it. Axe tests are covered by Lighthouse
anyway.
This commit is contained in:
Rohan Kumar 2021-01-09 20:48:42 -08:00
parent bd094a6608
commit 4d7625227b
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
7 changed files with 51 additions and 11 deletions

View file

@ -6,6 +6,7 @@ packages:
- brotli # for max compression w/ brotli_static, decompressing binaries - brotli # for max compression w/ brotli_static, decompressing binaries
- git # for Hugo's gitInfo - git # for Hugo's gitInfo
- make - make
- jq
- npm # for testing with lighthouse and webhint - npm # for testing with lighthouse and webhint
- chromium # for testing with lighthouse and webhint - chromium # for testing with lighthouse and webhint
environment: environment:
@ -33,5 +34,7 @@ tasks:
make DOMAIN=staging.seirdy.one ZOPFLI_ITERATIONS=50 test-staging make DOMAIN=staging.seirdy.one ZOPFLI_ITERATIONS=50 test-staging
tar czf ~/lighthouse-reports.tar.gz lighthouse-reports tar czf ~/lighthouse-reports.tar.gz lighthouse-reports
make clean deploy make clean deploy
cp mentions.json ~/mentions.json
artifacts: artifacts:
- lighthouse-reports.tar.gz - lighthouse-reports.tar.gz
- mentions.json

10
.gitignore vendored
View file

@ -1,9 +1,11 @@
public/
public_*/
hint-report/
.hintrc-*
*.report.html *.report.html
*.report.json *.report.json
.hintrc-*
.lighthouseci/* .lighthouseci/*
hint-report/
lighthouse-reports/* lighthouse-reports/*
mentions.json
node_modules/* node_modules/*
old/
public/
public_*/

View file

@ -14,6 +14,7 @@
], ],
"hints": { "hints": {
"apple-touch-icons": "off", "apple-touch-icons": "off",
"axe/aria": "off",
"axe/other": "error", "axe/other": "error",
"compat-api/css": [ "compat-api/css": [
"error", "error",

View file

@ -1,6 +1,6 @@
.well-known/
_*
misc/ misc/
music.txt music.txt
music.txt.gz music.txt.gz
.well-known webmentions/
_*
webmentions

View file

@ -28,7 +28,7 @@ hugo: clean
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports rm -rf $(OUTPUT_DIR) .lighthouseci lighthouse-reports mentions.json
.PHONY: lint-css .PHONY: lint-css
lint-css: lint-css:
@ -72,14 +72,23 @@ ifndef NO_STATIC
| xargs brotli -q 11 | xargs brotli -q 11
endif endif
# save webmentions to a file, don't send yet
mentions.json: hugo
# gather old version of the site
# rsync $(RSYNCFLAGS) --exclude '*.gz' --exclude '*.br' --exclude '*.png' --exclude-from .rsyncignore $(WWW_RSYNC_DEST)/ old
static-webmentions find
mv mentions.json mentions.json.unfiltered
# filter the webmentions a bit; jq offers more flexibility than config.toml
jq '[ .[] | select(.Dest|test("https://(git.sr.ht/~seirdy/seirdy.one/log/master|seirdy.one|web.archive.org|matrix.to)") | not) ]' <mentions.json.unfiltered >mentions.json
rm mentions.json.unfiltered
.PHONY: deploy-html .PHONY: deploy-html
deploy-html: build deploy-html: build mentions.json
rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete
.PHONY: deploy-gemini .PHONY: deploy-gemini
deploy-gemini: hugo deploy-gemini: hugo
rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude '*.gz' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.* $(GEMINI_RSYNC_DEST)/ --delete rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude '*.gz' --exclude '*.br' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.* $(GEMINI_RSYNC_DEST)/ --delete
rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml
.PHONY: deploy .PHONY: deploy
@ -87,7 +96,7 @@ deploy: deploy-html deploy-gemini
## stuff for the staging server ## stuff for the staging server
.PHONY: test-staging .PHONY: test-staging
test-staging: deploy-html test-staging:
yq e '.ci .collect .url | .[]' .lighthouserc.yml | xargs npx hint -f codeframe yq e '.ci .collect .url | .[]' .lighthouserc.yml | xargs npx hint -f codeframe
npx lhci autorun npx lhci autorun

View file

@ -42,4 +42,7 @@ To test in CI, after deploying to the staging environment:
- webhint CLI - webhint CLI
- [lighthouse-ci](https://github.com/GoogleChrome/lighthouse-ci) - [lighthouse-ci](https://github.com/GoogleChrome/lighthouse-ci)
CI also runs [static-webmention](https://github.com/nekr0z/static-webmentions) to
gather a list of WebMentions for me to send and review manually.
See the `Makefile` for details. The CI saves lighthouse reports as a build artifact. See the `Makefile` for details. The CI saves lighthouse reports as a build artifact.

View file

@ -78,6 +78,28 @@ path = "gemini/"
[outputs] [outputs]
section = ["HTML", "RSS", "GEMRSS"] section = ["HTML", "RSS", "GEMRSS"]
# https://github.com/nekr0z/static-webmentions
[webmentions]
newDir = "public"
oldDir = "old"
webmentionsFile = "mentions.json"
excludeSources = [
"/tags/*", # only trailing * are supported at the moment
"/posts/*", # this only excludes /posts/index.html, not /posts/somepost/
"/", # same as "/index.html"
]
# addresses that we don't want to send webmentions to
# other schemes and stuff that's I link to too often
excludeDestinations = [
"mailto:",
"gemini:",
"https://web.archive.org",
"https://lists.sr.ht/~seirdy/seirdy.one-comments",
"https://useplaintext.email/",
"https://seirdy.one",
]
[server] [server]
[[server.headers]] [[server.headers]]
for = "/**.{css,png,webp,webm}" for = "/**.{css,png,webp,webm}"