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

Internal: speed-up/fix check-whole-site

- Run webhint in parallel with other site checks, right after the
  deployment finishes
- Fix webhint perf budget (it warns when within 0.5 sec so give it a
  0.5 sec buffer)
- Throttle LH a bit more
This commit is contained in:
Rohan Kumar 2022-08-08 21:34:58 -07:00
parent 9a307d99dc
commit 21dc952eb2
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
3 changed files with 14 additions and 6 deletions

View file

@ -11,13 +11,18 @@ CHROME_PATH = $(CHROME_DIR)/thorium
CHROMEDRIVER_PATH = $(CHROME_DIR)/chromedriver CHROMEDRIVER_PATH = $(CHROME_DIR)/chromedriver
CHROME_PROFILE ?= /tmp/chrome-lighthouse CHROME_PROFILE ?= /tmp/chrome-lighthouse
JS_FLAGS='' JS_FLAGS=''
CHROME_FLAGS += --headless --disable-extensions --no-default-browser-check --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-device-discovery-notifications --disable-domain-reliability --disable-background-timer-throttling --disable-breakpad --enable-blink-features=LayoutInstabilityAPI --no-first-run --disable-background-networking --user-data-dir=$(CHROME_PROFILE) --enable-quic --start-in-incognito --origin-to-force-quic-on=$(DOMAIN):443 CHROME_FLAGS += --headless --disable-extensions --no-default-browser-check --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-device-discovery-notifications --disable-domain-reliability --disable-background-timer-throttling --disable-breakpad --enable-blink-features=LayoutInstabilityAPI --no-first-run --disable-background-networking --user-data-dir=$(CHROME_PROFILE) --enable-quic --start-in-incognito --origin-to-force-quic-on=seirdy.one:443
CHROME_FLAGS_COMMA = 'disable-extensions,no-default-browser-check,disable-client-side-phishing-detection,disable-component-update,disable-default-apps,disable-device-discovery-notifications,disable-domain-reliability,disable-background-timer-throttling,disable-breakpad,no-first-run,disable-background-networking,js-flags=--jitless' CHROME_FLAGS_COMMA = 'disable-extensions,no-default-browser-check,disable-client-side-phishing-detection,disable-component-update,disable-default-apps,disable-device-discovery-notifications,disable-domain-reliability,disable-background-timer-throttling,disable-breakpad,no-first-run,disable-background-networking,js-flags=--jitless'
CPU_SLOWDOWN=12.0 # When quiet, my lappie's CPU power is benchmarked to be ~1320. The CPU throttling calculator recommends throttling by 3.1x.
# Multiply that by 4 cuz imo it's way too generous. It targets devices like the Moto G4; I target devices like the JioPhone 2.
CPU_SLOWDOWN=12.5
LIGHTHOUSE_ARGS += --budget-path linter-configs/budget.json --output html --output json --output-file lighthouse-results --throttling-method=devtools --throttling.cpuSlowdownMultiplier=$(CPU_SLOWDOWN) --chrome-flags="$(CHROME_FLAGS)" LIGHTHOUSE_ARGS += --budget-path linter-configs/budget.json --output html --output json --output-file lighthouse-results --throttling-method=devtools --throttling.cpuSlowdownMultiplier=$(CPU_SLOWDOWN) --chrome-flags="$(CHROME_FLAGS)"
# make some of these quiet bc they'll otherwise echo every URL
hint-online: hint-online:
hint --config linter-configs/hintrc $(URLS) @echo "Running webhint"
@hint --config linter-configs/hintrc $(URLS)
lighthouse: lighthouse:
mkdir -p $(CHROME_PROFILE) mkdir -p $(CHROME_PROFILE)
CHROME_PATH=$(CHROME_PATH) CHROME_PROFILE=$(CHROME_PROFILE) JS_FLAGS='' lighthouse $(URLS) $(LIGHTHOUSE_ARGS) CHROME_PATH=$(CHROME_PATH) CHROME_PROFILE=$(CHROME_PROFILE) JS_FLAGS='' lighthouse $(URLS) $(LIGHTHOUSE_ARGS)
@ -27,8 +32,10 @@ redbot:
.PHONY: hint-online lighthouse redbot .PHONY: hint-online lighthouse redbot
axe: axe:
axe $(URLS) --chrome-options $(CHROME_FLAGS_COMMA) --chromedriver-path=$(CHROMEDRIVER_PATH) --show-errors @echo "Running axe"
@axe $(URLS) --chrome-options $(CHROME_FLAGS_COMMA) --chromedriver-path=$(CHROMEDRIVER_PATH) --show-errors
axe-ff: axe-ff:
@echo "Running axe with Firefox"
PATH=scripts/bin:$(PATH) axe $(URLS) -b firefox --show-errors PATH=scripts/bin:$(PATH) axe $(URLS) -b firefox --show-errors
.PHONY: axe axe-ff .PHONY: axe axe-ff

View file

@ -26,6 +26,7 @@
"axe/tables": "off", "axe/tables": "off",
"axe/text-alternatives": "off", "axe/text-alternatives": "off",
"axe/time-and-media": "off", "axe/time-and-media": "off",
"axe/parsing": "off",
"compat-api/css": [ "compat-api/css": [
"error", "error",
{ {
@ -93,7 +94,7 @@
"error", "error",
{ {
"connectionType": "3GSlow", "connectionType": "3GSlow",
"loadTime": 10 "loadTime": 10.5
} }
], ],
"css-prefix-order": "error", "css-prefix-order": "error",

View file

@ -63,8 +63,8 @@ base_url="${1-http://localhost:8089}"
make -j1 HUGO_FLAGS=-DF HUGO_BASEURL="$base_url" clean hugo xhtmlize validate-html make -j1 HUGO_FLAGS=-DF HUGO_BASEURL="$base_url" clean hugo xhtmlize validate-html
make -j "$jobs" -f Makefile.online HUGO_BASEURL="$base_url" all-extra URLS="$(curl -sSL "$base_url/sitemap.xml" | htmlq loc -t | rg -v '/search/$' | tr '\n' ' ')" & make -j "$jobs" -f Makefile.online HUGO_BASEURL="$base_url" all-extra URLS="$(curl -sSL "$base_url/sitemap.xml" | htmlq loc -t | rg -v '/search/$' | tr '\n' ' ')" &
make deploy-staging RSYNCFLAGS_EXTRA=-q make deploy-staging RSYNCFLAGS_EXTRA=-q
wait
make -f Makefile.online hint-online URLS="$(curl -sSL --compressed https://staging.seirdy.one/sitemap.xml | htmlq loc -t | rg -v '/(?:search|wcag-is-a-starting-point)/$' | sort | tr '\n' ' ')" make -f Makefile.online hint-online URLS="$(curl -sSL --compressed https://staging.seirdy.one/sitemap.xml | htmlq loc -t | rg -v '/(?:search|wcag-is-a-starting-point)/$' | sort | tr '\n' ' ')"
wait
# TODO: run lighthouse on every page in the sitemap. # TODO: run lighthouse on every page in the sitemap.
# vi:ft=sh # vi:ft=sh