Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 161 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,177 @@
name: CI

on:
push:
branches-ignore: ["main"]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
prepare:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- run: npm ci
- run: npx playwright install --with-deps chromium
- name: Use Playwright Chromium for article PDFs
run: echo "BROWSER_PATH=$(node -p 'require("@playwright/test").chromium.executablePath()')" >> "$GITHUB_ENV"
- run: bin/build
- name: Build main once and select affected pages
run: bin/compare-builds origin/${{ github.base_ref || 'main' }}
- name: Share the builds and affected page manifest
uses: actions/upload-artifact@v4
with:
name: prepared-site
path: |
_site/
.ignored/site-checks/base/
playwright-report/
include-hidden-files: true
if-no-files-found: error
retention-days: 1

site-checks:
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- run: bin/check_unicode
- run: bin/build
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
- run: npm ci
- run: npx playwright install --with-deps chromium
- uses: actions/download-artifact@v4
with:
name: prepared-site
path: .
- name: Internal links, affected-page overflow and JavaScript checks
run: bin/check --prepared --skip-audit
- name: Upload browser check report
if: always()
uses: actions/upload-artifact@v4
with:
name: browser-checks-report
path: playwright-report/
if-no-files-found: warn
retention-days: 7

unlighthouse:
needs: prepare
runs-on: ubuntu-latest
# A shared CSS change can legitimately select the whole site.
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
- uses: actions/download-artifact@v4
with:
name: prepared-site
path: .
- name: Audit every affected page
run: bin/unlighthouse
- name: Upload Unlighthouse dashboard and scores
id: artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: unlighthouse-report
path: .unlighthouse/
include-hidden-files: true
if-no-files-found: warn
retention-days: 7
- name: Explain audit download
if: always()
run: |
cat <<'MARKDOWN' >> "$GITHUB_STEP_SUMMARY"
## Unlighthouse

[Download the audit dashboard and scores](${{ steps.artifact.outputs.artifact-url }})

Download and unzip `unlighthouse-report.zip`, then double-click `index.html`.
The summary, screenshots and detailed Lighthouse HTML reports open directly in your browser, offline.
No commands, installed project dependencies or local server are needed.
Only affected pages are audited; no affected pages produces a skip report.
Audits run in parallel with browser checks and visual review. Scores remain required.
MARKDOWN

visual:
needs: prepare
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
- uses: actions/download-artifact@v4
with:
name: prepared-site
path: .
- name: Screenshot affected pages and compare with main
continue-on-error: true
run: bin/visual-diff --prepared
- name: Upload screenshots and visual differences
id: artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
if-no-files-found: warn
retention-days: 7
- name: Explain visual report download
if: always()
run: |
cat <<'MARKDOWN' >> "$GITHUB_STEP_SUMMARY"
## Screenshots and differences

[Download the visual report and images](${{ steps.artifact.outputs.artifact-url }})

Download and unzip `playwright-report.zip`, then double-click `index.html`.
Screenshots and differences are embedded in the HTML and work offline.
No commands, installed project dependencies or local server are needed.
Affected pages are captured at 360, 768 and 1280 pixels wide, with screenshots and image differences.
Unchanged pages are omitted.
Visual differences do not fail the required check.
MARKDOWN

check:
if: always()
needs: [prepare, site-checks, unlighthouse]
runs-on: ubuntu-latest
steps:
- name: Require build, browser checks and audit scores
env:
PREPARE_RESULT: ${{ needs.prepare.result }}
SITE_CHECKS_RESULT: ${{ needs.site-checks.result }}
AUDIT_RESULT: ${{ needs.unlighthouse.result }}
run: |
test "$PREPARE_RESULT" = success
test "$SITE_CHECKS_RESULT" = success
test "$AUDIT_RESULT" = success
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Purge Cloudflare cache
if: steps.deployment.outcome == 'success'
run: |
curl -s -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \
curl -fsS -X POST "https://api.cloudflare.com/client/v4/zones/${{ secrets.CLOUDFLARE_ZONE_ID }}/purge_cache" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ vendor/
# Node.js build dependencies
node_modules/

# Playwright reports and temporary visual references
playwright-report/
test-results/
.screenshots/

# Lighthouse reports
.lighthouseci/
.unlighthouse/

# Local check preparation and agent progress
.ignored/

# macOS-specific files
.DS_Store

Expand Down
11 changes: 11 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Agent Notes

## Checks

- Track work in `.ignored/todo.md` using a detailed checklist with subtasks. Keep
the current task and a description of the work at the top.
- Agents MUST run `bin/check` before claiming a change is done.
- For visual changes, also run `bin/visual-diff` against the existing current site
build and point the user to the Playwright report. Only affected generated pages
and pages referencing changed assets are captured. Visual differences are advisory.
- Never commit screenshots or generated report images.
- Include an identifiable favicon when creating an HTML page; letters are fine.

## Variants Workflow

When the user asks for variants, proposals, comparisons, or alternatives for a page/component/design:
Expand Down
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ gem "fastimage"
gem "ferrum", "~> 0.18"
gem "nokogiri", "~> 1.19"

group :test do
gem "html-proofer"
end

group :jekyll_plugins do
gem "jekyll-sitemap"
end
42 changes: 42 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
GEM
remote: https://rubygems.org/
specs:
Ascii85 (2.0.1)
addressable (2.8.8)
public_suffix (>= 2.0.2, < 8.0)
afm (1.0.0)
async (2.46.0)
console (~> 1.29)
fiber-annotation
io-event (~> 1.21)
base64 (0.3.0)
benchmark (0.5.0)
bigdecimal (4.0.1)
colorator (1.1.0)
concurrent-ruby (1.3.6)
console (1.38.0)
fiber-annotation
fiber-local (~> 1.1)
json
csv (3.3.5)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
ethon (0.18.0)
ffi (>= 1.15.0)
logger
eventmachine (1.2.7)
fastimage (2.4.0)
ferrum (0.18.0)
Expand All @@ -29,6 +43,10 @@ GEM
ffi (1.17.3-x86_64-darwin)
ffi (1.17.3-x86_64-linux-gnu)
ffi (1.17.3-x86_64-linux-musl)
fiber-annotation (0.2.0)
fiber-local (1.1.0)
fiber-storage
fiber-storage (1.0.1)
forwardable-extended (2.6.0)
google-protobuf (4.33.5)
bigdecimal
Expand Down Expand Up @@ -57,10 +75,22 @@ GEM
google-protobuf (4.33.5-x86_64-linux-musl)
bigdecimal
rake (>= 13)
hashery (2.1.2)
html-proofer (5.2.2)
addressable (~> 2.3)
async (~> 2.1)
benchmark (~> 0.5)
nokogiri (~> 1.13)
pdf-reader (~> 2.11)
rainbow (~> 3.0)
typhoeus (~> 1.3)
yell (~> 2.0)
zeitwerk (~> 2.5)
htmlbeautifier (1.4.3)
http_parser.rb (0.8.1)
i18n (1.14.8)
concurrent-ruby (~> 1.0)
io-event (1.22.1)
jekyll (4.4.1)
addressable (~> 2.4)
base64 (~> 0.2)
Expand Down Expand Up @@ -120,8 +150,14 @@ GEM
racc (~> 1.4)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
pdf-reader (2.16.0)
Ascii85 (>= 1.0, < 3.0, != 2.0.0)
afm (>= 0.2.1, < 2)
hashery (~> 2.0)
ttfunk
public_suffix (7.0.2)
racc (1.8.1)
rainbow (3.1.1)
rake (13.3.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
Expand Down Expand Up @@ -162,12 +198,17 @@ GEM
google-protobuf (~> 4.31)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
ttfunk (1.7.0)
typhoeus (1.6.0)
ethon (>= 0.18.0)
unicode-display_width (2.6.0)
webrick (1.9.2)
websocket-driver (0.8.2)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
yell (2.2.2)
zeitwerk (2.8.3)

PLATFORMS
aarch64-linux-android
Expand All @@ -193,6 +234,7 @@ PLATFORMS
DEPENDENCIES
fastimage
ferrum (~> 0.18)
html-proofer
htmlbeautifier
jekyll (~> 4.3)
jekyll-sitemap
Expand Down
37 changes: 33 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,47 @@ Personal portfolio and blog built with [Jekyll](https://jekyllrb.com/).

## Development

Requires Ruby/Bundler, Node.js 22+, and Chrome 131+.
Requires Ruby/Bundler, Node.js 22.18+, and Chrome 131+ for article PDFs.

```sh
bundle install
bin/run # build and serve at localhost:4000
bin/build # build the site and article PDFs
npm ci
npx playwright install chromium
bin/run # build and serve at localhost:4000
bin/build # build the site and article PDFs
bin/check # local CI: build, links, affected-page checks and audits
bin/visual-diff --prepared # reuse bin/check's builds for screenshots and differences
bin/unlighthouse # audit affected pages in an existing prepared build
```

Both commands install npm dependencies. `bin/run` does not rebuild on changes;
`bin/run` and `bin/build` install npm dependencies. `bin/run` does not rebuild on changes;
restart it to refresh. Arguments go to `jekyll serve` or `jekyll build`, respectively.
Set `BROWSER_PATH` if Chrome or Chromium is installed in a nonstandard location.

Run `bin/check` before finishing a change. It builds the current site and a fresh
`origin/main`, checks internal links, then checks affected pages for overflow,
JavaScript errors and Unlighthouse scores. Unlighthouse uses Playwright's Chromium,
with a minimum score of 0.95 in each category. An unchanged site skips browser
captures and audits.

`bin/visual-diff --prepared` reuses the two builds from `bin/check`.
Standalone `bin/visual-diff [base-ref]` expects the current `_site` build to exist
and builds a fresh base (default `origin/main`). It compares
generated HTML and referenced assets, then captures only affected pages at 360,
768 and 1280 pixels wide. Shared CSS or scripts can affect many pages. Screenshots
and reports stay in ignored directories. Double-click `playwright-report/index.html`
to view the report in your browser. Screenshots and diffs are embedded in the HTML.

CI builds both refs once, then runs browser checks, visual review and Unlighthouse
in parallel. The required `check` status waits for browser checks and Unlighthouse;
visual differences are advisory. Download `playwright-report` from a run's
**Artifacts** section or visual job summary, unzip it, then double-click `index.html`.
The report works offline without commands, a local server or installed dependencies.

For audits, download and unzip `unlighthouse-report`, then double-click `index.html`.
Its scores, screenshots and detailed Lighthouse reports open directly in your browser.
`browser-checks-report` opens the same way and contains overflow and JavaScript results.

## License

CC-BY-4.0
Loading
Loading