This document defines how CNN Visualizer V1 is built, validated, and deployed as a static web application using Vite, GitHub Actions, and GitHub Pages.
Deployment model:
- Build static assets from source with Vite.
- Publish generated artifacts to GitHub Pages.
- Automate with CI on the default branch.
This aligns with the project requirement of zero backend runtime.
- Source repository hosted on GitHub.
- Default branch:
main(or project equivalent). - Node.js LTS available in CI.
npm ciused for deterministic dependency installs.
Build command contract:
npm ci
npm run buildExpected output:
- Vite build artifacts in
dist/.
Static asset requirements:
- Model files under
public/model/must be copied todist/model/. - Paths must resolve correctly under GitHub Pages base URL.
For repository pages deployment (e.g., /repo-name/), configure:
base: '/<repo-name>/'in production mode.
For user/org root pages, base may remain /.
Validation rule:
- App routes and model asset URLs must resolve correctly after deployment.
Recommended workflow stages:
- Checkout source.
- Setup Node.js and cache npm dependencies.
- Install dependencies (
npm ci). - Run lint/tests (if configured).
- Build production bundle (
npm run build). - Upload artifact and deploy to GitHub Pages.
name: Deploy CNN Visualizer
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- run: npm run build
- uses: actions/upload-pages-artifact@v3
with:
path: dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- id: deployment
uses: actions/deploy-pages@v4Recommended flow:
- Feature branches for implementation.
- Pull request into default branch with checks passing.
- Merge triggers production deployment.
Optional hardening:
- require status checks before merge,
- protect default branch,
- require one reviewer approval.
After each production deploy:
- App loads without blank-screen/runtime crash.
- Model file fetch from
/model/model.jsonsucceeds. - Drawing -> inference -> output loop works.
- Layer visualization and controls function.
- Mobile viewport remains usable.
If production deployment fails:
- Revert offending commit on default branch.
- Trigger redeploy from last known good commit.
- Confirm model asset integrity and base-path correctness.
- Wrong Vite
basepath causing broken assets. - Missing model files in
public/model/. - CI using incompatible Node.js version.
- Build passes locally but fails in CI due to lockfile drift.
Mitigation:
- Keep lockfile committed and current.
- Validate production-like build locally before merge.
- Add CI smoke test for model asset fetch and app bootstrap.
Track basic delivery health:
- Build success rate.
- Deployment duration.
- Mean time to recover from failed deploy.
- Number of rollback events per release window.
This deployment design is selected because it is:
- infrastructure-light (static hosting only),
- cost-efficient for educational applications,
- reproducible through CI automation,
- fully aligned with a browser-only inference architecture.