Skip to content

Commit 34eab28

Browse files
committed
trigger Lighthouse CI via workflow_dispatch
1 parent f0ae5c5 commit 34eab28

6 files changed

Lines changed: 135 additions & 3 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Lighthouse Dashboard
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
lighthouse:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Node
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: npm
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build static site
29+
run: npm run web:build
30+
31+
- name: Run Lighthouse CI
32+
id: lighthouse
33+
uses: treosh/lighthouse-ci-action@v12
34+
with:
35+
configPath: ./.lighthouserc.json
36+
uploadArtifacts: true
37+
temporaryPublicStorage: true
38+
39+
- name: Publish dashboard links
40+
env:
41+
LINKS_JSON: ${{ steps.lighthouse.outputs.links }}
42+
run: |
43+
node -e '
44+
const links = JSON.parse(process.env.LINKS_JSON || "[]");
45+
const lines = ["## Lighthouse Temporary Dashboard", ""];
46+
if (links.length === 0) {
47+
lines.push("No public links were produced by Lighthouse CI.");
48+
} else {
49+
for (const link of links) {
50+
lines.push(`- ${link}`);
51+
}
52+
}
53+
require("node:fs").appendFileSync(process.env.GITHUB_STEP_SUMMARY, `${lines.join("\n")}\n`);
54+
'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
/test-results
44
/playwright-report
55
/coverage
6+
.omx

.lighthouserc.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"ci": {
3+
"collect": {
4+
"staticDistDir": "./dist",
5+
"url": ["http://localhost:8080/"],
6+
"numberOfRuns": 3
7+
},
8+
"assert": {
9+
"assertions": {
10+
"categories:performance": ["warn", { "minScore": 0.9 }],
11+
"categories:accessibility": ["warn", { "minScore": 0.9 }],
12+
"categories:best-practices": ["warn", { "minScore": 0.9 }],
13+
"categories:seo": ["warn", { "minScore": 0.9 }]
14+
}
15+
},
16+
"upload": {
17+
"target": "temporary-public-storage"
18+
}
19+
}
20+
}

index.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,32 @@
33
<head>
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<meta
7+
name="description"
8+
content="Interactive Toy Robot simulator with command presets, script mode, and live board updates."
9+
/>
10+
<meta name="theme-color" content="#08122e" />
11+
<link rel="preconnect" href="https://fonts.googleapis.com" />
12+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
13+
<link
14+
rel="preload"
15+
as="style"
16+
href="https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap"
17+
/>
18+
<link
19+
rel="stylesheet"
20+
href="https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap"
21+
media="print"
22+
onload="this.media='all'"
23+
/>
24+
<noscript>
25+
<link
26+
rel="stylesheet"
27+
href="https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap"
28+
/>
29+
</noscript>
630
<title>Toy Robot Game</title>
31+
<link rel="preload" href="./web/styles.css" as="style" />
732
<link rel="stylesheet" href="./web/styles.css" />
833
</head>
934
<body>

scripts/serve-static.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ function resolveFilePath(rootDir, requestUrl = "/") {
5858
function sendFile(filePath, requestMethod, response) {
5959
const ext = path.extname(filePath).toLowerCase();
6060
const contentType = mimeType[ext] || "application/octet-stream";
61-
setHeaders(response, 200, { "Content-Type": contentType });
61+
const cacheControl =
62+
ext === ".html" ? "no-cache" : "public, max-age=31536000, immutable";
63+
setHeaders(response, 200, {
64+
"Content-Type": contentType,
65+
"Cache-Control": cacheControl,
66+
});
6267

6368
if (requestMethod === "HEAD") {
6469
response.end();

web/styles.css

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@import url("https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=DM+Sans:wght@400;500;700&display=swap");
2-
31
:root {
42
--bg: #08122e;
53
--bg-alt: #0f214f;
@@ -75,6 +73,8 @@ body::after {
7573
transform: translateY(18px) scale(0.98);
7674
opacity: 0;
7775
animation: reveal-panel 620ms cubic-bezier(0.2, 0.8, 0.25, 1) forwards;
76+
content-visibility: auto;
77+
contain-intrinsic-size: 420px;
7878
}
7979

8080
.panel:nth-child(1) {
@@ -338,6 +338,18 @@ button:active {
338338
transform: translateY(-2px);
339339
}
340340

341+
.cell:has(.robot) {
342+
background:
343+
linear-gradient(170deg, #fff, #eef6ff),
344+
repeating-linear-gradient(
345+
45deg,
346+
rgba(24, 56, 120, 0.03),
347+
rgba(24, 56, 120, 0.03) 5px,
348+
transparent 5px,
349+
transparent 10px
350+
);
351+
}
352+
341353
.coord {
342354
font-size: 0.7rem;
343355
color: #5e739c;
@@ -443,3 +455,18 @@ button:active {
443455
grid-template-columns: repeat(2, minmax(90px, 1fr));
444456
}
445457
}
458+
459+
@media (prefers-reduced-motion: reduce) {
460+
.panel,
461+
.robot,
462+
.cell,
463+
button,
464+
.latest-status,
465+
input,
466+
textarea,
467+
select {
468+
animation: none !important;
469+
transition: none !important;
470+
transform: none !important;
471+
}
472+
}

0 commit comments

Comments
 (0)