Skip to content

Commit ada79b8

Browse files
committed
Update CI workflow files to start dev server and remove build step
1 parent 29f4e1b commit ada79b8

10 files changed

Lines changed: 405 additions & 402 deletions

File tree

‎.github/workflows/build-and-test.yml‎

Lines changed: 43 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Runs build, unit tests, and E2E tests - gates deployment
2-
# @TODO: Push to a preview branch on Vercel, and run the E2E tests on that preview instead of from a dev server
3-
name: CI - Build & Test
2+
name: Build and Test
43

54
on:
65
push:
6+
branches:
7+
- main
78
pull_request:
8-
branches: [main]
9+
branches:
10+
- main
911

1012
jobs:
1113
build-and-test:
@@ -39,7 +41,7 @@ jobs:
3941

4042
steps:
4143
- name: Checkout repository
42-
uses: actions/checkout@v6
44+
uses: actions/checkout@v4
4345

4446
- name: Setup Node.js
4547
uses: actions/setup-node@v4
@@ -50,7 +52,10 @@ jobs:
5052
- name: Install dependencies
5153
run: npm ci --legacy-peer-deps
5254

53-
- name: Run TypeScript check
55+
- name: Sync Astro types
56+
run: npm run sync
57+
58+
- name: Run Astro check
5459
run: npm run check
5560

5661
- name: Run lint
@@ -61,7 +66,7 @@ jobs:
6166
# Run vitest with coverage. The built-in 'github-actions' reporter
6267
# (configured in vitest.config.ts) will create annotations.
6368
# Coverage reporters (json-summary, json) are configured in vitest.config.ts.
64-
npx vitest run --coverage
69+
npm run test:coverage
6570
6671
- name: Report Coverage
6772
uses: davelosert/vitest-coverage-report-action@v2.9.0
@@ -70,11 +75,6 @@ jobs:
7075
json-summary-path: './coverage/coverage-summary.json'
7176
json-final-path: './coverage/coverage-final.json'
7277

73-
- name: Build project
74-
run: npm run build
75-
env:
76-
NODE_ENV: production
77-
7878
- name: Install Playwright browsers
7979
run: npx playwright install --with-deps
8080

@@ -116,11 +116,41 @@ jobs:
116116
- name: Apply Supabase migrations
117117
run: npm run containers:supabase:db-push
118118

119+
- name: Start Astro dev server
120+
run: |
121+
npm run dev -- --host 0.0.0.0 > /tmp/astro-dev.log 2>&1 &
122+
echo $! > /tmp/astro-dev.pid
123+
124+
- name: Wait for dev server
125+
run: |
126+
for attempt in $(seq 1 60); do
127+
if curl -fsS http://127.0.0.1:4321 >/dev/null; then
128+
echo "✅ Dev server is responding"
129+
exit 0
130+
fi
131+
sleep 2
132+
done
133+
echo "❌ Dev server failed to start" >&2
134+
if [ -f /tmp/astro-dev.log ]; then
135+
echo '--- Astro dev server log ---'
136+
cat /tmp/astro-dev.log
137+
fi
138+
exit 1
139+
119140
- name: Run Playwright E2E tests
120141
run: npx playwright test
121142
env:
122143
CI: "1"
123144
FORCE_COLOR: "1"
145+
E2E_MOCKS: "1"
146+
147+
- name: Stop Astro dev server
148+
if: always()
149+
run: |
150+
if [ -f /tmp/astro-dev.pid ]; then
151+
kill $(cat /tmp/astro-dev.pid) || true
152+
rm /tmp/astro-dev.pid
153+
fi
124154
125155
- name: Upload Playwright report
126156
uses: actions/upload-artifact@v4
@@ -155,7 +185,7 @@ jobs:
155185

156186
steps:
157187
- name: Checkout repository
158-
uses: actions/checkout@v6
188+
uses: actions/checkout@v4
159189

160190
- name: Deploy to Vercel (Preview)
161191
uses: amondnet/vercel-action@v41.1.4
@@ -201,7 +231,7 @@ jobs:
201231

202232
steps:
203233
- name: Checkout repository
204-
uses: actions/checkout@v6
234+
uses: actions/checkout@v4
205235

206236
- name: Deploy to Vercel (Production)
207237
uses: amondnet/vercel-action@v41.1.4

‎.github/workflows/codeql.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ name: CodeQL Advanced Security Scanning
33

44
on:
55
push:
6-
branches: [main]
6+
branches:
7+
- main
78
pull_request:
8-
branches: [main]
9+
branches:
10+
- main
911
schedule:
1012
# Run at 6 AM UTC every Monday
1113
- cron: '0 6 * * 1'
@@ -26,7 +28,7 @@ jobs:
2628

2729
steps:
2830
- name: Checkout repository
29-
uses: actions/checkout@v6
31+
uses: actions/checkout@v4
3032

3133
- name: Initialize CodeQL
3234
uses: github/codeql-action/init@v3

‎.github/workflows/dependency-review.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repository
18-
uses: actions/checkout@v6
18+
uses: actions/checkout@v4
1919

2020
- name: Dependency Review
2121
uses: actions/dependency-review-action@v4

‎.github/workflows/type-check.yml‎

Lines changed: 0 additions & 51 deletions
This file was deleted.

‎.vscode/settings.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"Bridgy",
1616
"bsky",
1717
"Btns",
18+
"Buildx",
1819
"CASB",
1920
"Centricity",
2021
"cfduid",

‎E2E_STESS_TESTS.md‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!-- markdownlint-disable-file -->
2+
# E2E Stress Tests
3+
4+
Our goal is to make the E2E test suite as deterministic as possible, so that we can use it as a gate for CI to make sure that commits and PRs on GitHub are not breaking existing code and can be merged to main. We've spent an entire day running the test cases and fixing errors. Each run, one or more new errors appear, we fix them, and do another run with the same result. The entire test suite seems very flaky.
5+
6+
## Problems Areas
7+
8+
### 1. Carousel / Testimonials Hydration Regressions
9+
10+
- **Symptom:**
11+
12+
`testimonials.spec.ts` consistently fails in WebKit because the target pagination dot never registers as selected (`Expected: 1 Received: 0`). Earlier stress runs also timed out waiting for `data-carousel-ready`, implying the custom element never finishes initialization.
13+
14+
- **Diagnostics:**
15+
16+
- Inspect built HTML for `/testing/carousel` and the home page to confirm the inline `<script type="module">` blocks that call `register{Carousel,Testimonials}WebComponent()` survive bundling and execute under Playwright.
17+
18+
- Capture console output during a focused run (e.g., `testimonials.spec.ts` on Chromium) to see whether Embla throws inside `initialize()` or whether `handleScriptError` tears the element down before setting `data-carousel-ready`.
19+
20+
### 2. Service Worker Enablement
21+
22+
- **Symptom:**
23+
24+
PWA specs intermittently wait more than 30 seconds for `navigator.serviceWorker.ready`, suggesting `window.__disableServiceWorkerForE2E` may remain `true` despite `PwaPage.enableServiceWorkerForE2E()`.
25+
26+
- **Diagnostics:**
27+
28+
- Log the flag inside `registerServiceWorker()` to prove whether our init script overrides take effect before the registration guard runs.
29+
30+
- Audit `addInitScript` ordering to ensure no later script reverts the flag.
31+
32+
### 3. Theme Picker Reload Policy
33+
34+
- **Symptom:**
35+
36+
`theme-picker.spec.ts` fails on WebKit with `page.reload: Navigation canceled by policy check` when `setupCleanTestPage()` forces a hard reload to reset cookies.
37+
38+
- **Diagnostics:**
39+
40+
- Instrument `helpers/cookieHelper.ts` to capture the URL and policy state when the reload is blocked.
41+
42+
- Evaluate alternative reset flows (for example, `page.goto()` with a cache-busting query) so tests do not rely on reload semantics that WebKit disallows under our CSP/service-worker combo.
43+
44+
## Coordinated Troubleshooting Plan
45+
46+
1. **Isolate failures quickly:**
47+
48+
Run the individual specs above in Chromium and WebKit to capture console logs, traces, and screenshots before applying fixes so we have solid before/after evidence.
49+
50+
2. **Instrument before patching:**
51+
52+
Add temporary logging hooks (build-script inspection, SW flag checks, reload diagnostics) to validate hypotheses with a single rerun, then remove or guard them once validated.
53+
54+
3. **Apply targeted fixes sequentially:**
55+
56+
Fix hydration/registration issues first because they affect multiple specs, then re-run only the impacted specs; once clean, fold in the PWA and theme-picker adjustments and repeat.
57+
58+
4. **Re-run stress subset:**
59+
60+
After each fix cluster, run a reduced but representative bundle (for example, `testimonials`, `theme-picker`, `pwa`) across browsers to catch regressions early.
61+
62+
5. **Full-suite verification:**
63+
64+
Once subsets are stable, kick off the full stress suite to confirm deterministic behavior, and keep this document updated with any new regressions instead of relying on scrollback.
65+
66+
4. **Re-run stress subset**

‎_TODO.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
1+
<!-- markdownlint-disable-file -->
12
# TODO
23

4+
Inspect the built HTML for /testing/carousel and the home page to confirm the inline `<script type="module">` blocks that call register{Carousel,Testimonials}WebComponent() are still present after bundling. If they're getting tree-shaken or deferred incorrectly, the custom elements would never hydrate, which matches the data-carousel-ready hang.
5+
6+
Capture console output during one stress-run slice (e.g., testimonials.spec.ts in Chromium) to see if the Embla modules or our error handler are throwing—any runtime exception inside initialize() would tear down the element and prevent the ready flag. I'll focus on the [TestimonialsCarouselElement] initialize log path.
7+
8+
For the service-worker suite, verify that PwaPage.enableServiceWorkerForE2E() actually overrides window.__disableServiceWorkerForE2E after each navigation by logging the flag inside registerServiceWorker() before the early-return, and make sure our init scripts run in the right order when multiple addInitScript calls are stacked.
9+
10+
## Pause and Play
11+
12+
Next, I'd like to add a "pause" and "play" icon to src/components/Animations/Computers
13+
There are icons with those names already configured for the Icon component.
14+
There are hooks for pause and play already setup in the component.
15+
The icon should be displayed in the low right hand corner of the animation, with 4px of padding from the bottom and right side. It should overlay the animation, not expand the bounding box of the animation.
16+
317
## Performance
418

519
Implement mitigations in test/e2e/specs/07-performance/PERFORMANCE.md

0 commit comments

Comments
 (0)