Skip to content
Merged
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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
# Keeps the SHA-pinned actions in .github/workflows up to date, including their version comments
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
groups:
github-actions:
patterns: ["*"]
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test

on:
pull_request:
push:
branches: [main]

# Actions are pinned to commit SHAs (the version is in the trailing comment) so a moved tag can't
# change what runs
permissions:
contents: read

jobs:
e2e:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# Installs the tools pinned in mise.toml (and mise.lock), so Node matches local development
- uses: jdx/mise-action@d5574b52816a478f9d4e6529a3f6ff17a8a36785 # v5.2.8
with:
version: 2026.9.15
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.npm
key: npm-${{ runner.os }}-${{ hashFiles('package-lock.json') }}
restore-keys: npm-${{ runner.os }}-
- run: npm ci
- id: playwright-version
run: echo "version=$(npx playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
id: playwright-browsers-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
# System libraries live outside the cached path, so they're installed on every run
- run: npx playwright install --with-deps chromium
if: steps.playwright-browsers-cache.outputs.cache-hit != 'true'
- run: npx playwright install-deps chromium
if: steps.playwright-browsers-cache.outputs.cache-hit == 'true'
- run: npm test
# On failure, keep Playwright's traces (recorded on the first retry) for debugging with
# `npx playwright show-trace`
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: failure()
with:
name: playwright-traces
path: test-results
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ _site

.wrangler
.dev.vars

# Playwright
test-results
playwright-report
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ Preview versions are served from a `*-tools-passkeys-dev.passkeydeveloper.worker

### Deployment

The site is a Cloudflare Worker serving the built `_site/` directory as static assets (see `wrangler.jsonc`). It is not a Pages project. In Cloudflare, connect the repository under Workers & Pages as a Worker (Workers Builds) with build command `npm run build`, deploy command `npx wrangler deploy`, and non-production branch deploy command `npx wrangler versions upload`.
The site is a Cloudflare Worker serving the built `_site/` directory as static assets (see `wrangler.jsonc`). It is not a Pages project. In Cloudflare, connect the repository under Workers & Pages as a Worker (Workers Builds) with build command `npm run build`, deploy command `npx wrangler deploy`, and, for non-production branches, preview command `npx wrangler preview` (Worker Previews; the older `npx wrangler versions upload` fails the Workers Builds Worker check once previews are enabled).

To deploy by hand, run `npm run deploy`. `npm run preview` uploads a version without promoting it and prints its preview URL.
To deploy by hand, run `npm run deploy`. `npm run preview` creates a Preview deployment without promoting anything and prints its preview URL.

## Structure

Expand Down
46 changes: 46 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
"devDependencies": {
"@11ty/eleventy": "^3.1.5",
"@cloudflare/workers-types": "^5.20261103.1",
"@playwright/test": "^1.65.0",
"@quasibit/eleventy-plugin-sitemap": "^2.2.0",
"eleventy-plugin-metagen": "^1.8.4",
"luxon": "^3.7.2",
"typescript": "^7.0.2",
"wrangler": "^4.157.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "playwright test",
"dev": "npm run build && wrangler dev",
"build": "npx @11ty/eleventy",
"build:watch": "npx @11ty/eleventy --watch",
"typecheck": "tsc --noEmit",
"deploy": "npm run typecheck && npm run build && wrangler deploy",
"preview": "npm run typecheck && npm run build && wrangler versions upload",
"preview": "npm run typecheck && npm run build && wrangler preview",
"watch": "npx @11ty/eleventy --watch"
},
"repository": {
Expand Down
27 changes: 27 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { defineConfig, devices } from '@playwright/test';

const PORT = 8090;

export default defineConfig({
testDir: 'tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
// A test that only passes on retry is still a failure; the retry exists to capture a trace
failOnFlakyTests: !!process.env.CI,
reporter: process.env.CI ? 'github' : 'list',
use: {
// `localhost` is a secure context, which WebAuthn requires
baseURL: `http://localhost:${PORT}`,
trace: 'on-first-retry',
},
// The virtual authenticator is driven through the Chrome DevTools Protocol
projects: [{ name: 'chromium', use: { ...devices['Desktop Chrome'] } }],
// Only the static site is served; the API is mocked per test (see tests/helpers.ts) because the
// real one needs the webauthnapi-passkeys-dev Worker
webServer: {
command: `npx @11ty/eleventy --serve --quiet --port=${PORT}`,
url: `http://localhost:${PORT}`,
reuseExistingServer: !process.env.CI,
},
});
9 changes: 9 additions & 0 deletions src/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,14 @@
<script src="{{ script }}"></script>
{% endfor %}
{% endif %}
{% if extra_modules %}
{% for script in extra_modules %}
<script type="module" src="{{ script }}"></script>
{% endfor %}
{% endif %}
{# Deferred so it runs after module scripts, which have registered their `alpine:init` listeners #}
{% if alpine %}
<script defer src="/assets/js/alpinejs.3.17.5.min.js"></script>
{% endif %}
</body>
</html>
Loading
Loading