Skip to content

Commit 04f487a

Browse files
ci: add Bun validation and deploy workflows
Co-authored-by: Rahul Chalamala <rchalamala@users.noreply.github.com>
1 parent 4629e06 commit 04f487a

3 files changed

Lines changed: 193 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
- agent
9+
- "cursor/**"
10+
workflow_dispatch:
11+
12+
concurrency:
13+
group: ci-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
permissions:
17+
contents: read
18+
19+
jobs:
20+
quality:
21+
name: Lint, test, and build
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 20
24+
25+
steps:
26+
- name: Check out repository
27+
uses: actions/checkout@v4
28+
29+
- name: Set up Bun
30+
uses: oven-sh/setup-bun@v2
31+
with:
32+
bun-version-file: ".bun-version"
33+
34+
- name: Restore Bun cache
35+
uses: actions/cache@v4
36+
with:
37+
path: ~/.bun/install/cache
38+
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
39+
restore-keys: |
40+
${{ runner.os }}-bun-
41+
42+
- name: Install dependencies
43+
run: bun install --frozen-lockfile
44+
45+
- name: Run lint
46+
run: bun run lint
47+
48+
- name: Run tests
49+
run: bun run test:run
50+
51+
- name: Build app
52+
run: bun run build
53+
54+
- name: Upload coverage artifact
55+
if: always()
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: coverage
59+
path: coverage
60+
if-no-files-found: error

.github/workflows/deploy.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Deploy to Cloudflare Pages/Workers on push to main.
2+
#
3+
# Required repository secrets:
4+
# CLOUDFLARE_API_TOKEN - API token with Workers Scripts:Edit permission
5+
# CLOUDFLARE_ACCOUNT_ID - Cloudflare account ID
6+
#
7+
# The wrangler.jsonc file in the repo root configures the deploy target,
8+
# routes, and SPA not-found handling.
9+
10+
name: Deploy
11+
12+
on:
13+
push:
14+
branches: [main]
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: deploy-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
permissions:
22+
contents: read
23+
24+
jobs:
25+
deploy:
26+
name: Build and deploy
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 15
29+
30+
steps:
31+
- name: Check out repository
32+
uses: actions/checkout@v4
33+
34+
- name: Set up Bun
35+
uses: oven-sh/setup-bun@v2
36+
with:
37+
bun-version-file: ".bun-version"
38+
39+
- name: Restore Bun cache
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/.bun/install/cache
43+
key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}
44+
restore-keys: |
45+
${{ runner.os }}-bun-
46+
47+
- name: Install dependencies
48+
run: bun install --frozen-lockfile
49+
50+
- name: Build app
51+
run: bun run build
52+
53+
- name: Deploy to Cloudflare
54+
uses: cloudflare/wrangler-action@v3
55+
with:
56+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
57+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
58+
command: deploy

README.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,78 @@ Made with ❤️ by [Rahul](https://github.com/rchalamala/), [Eric](https://gith
55
In addition, thanks to [Armeet](https://github.com/armeetjatyani/) and others for suggestions/contributions!
66

77
Favicon art by Audrey Wong.
8+
9+
## Development
10+
11+
Install dependencies:
12+
13+
```bash
14+
bun install
15+
```
16+
17+
Start the dev server (Vite, port 3000):
18+
19+
```bash
20+
bun run dev
21+
```
22+
23+
## Validation
24+
25+
The repository includes a GitHub Actions CI workflow (`.github/workflows/ci.yml`)
26+
that runs the same core checks used locally:
27+
28+
```bash
29+
bun run lint # ESLint with zero-warning policy
30+
bun run test:run # Vitest with coverage
31+
bun run build # TypeScript type-check + Vite production build
32+
```
33+
34+
To run the full validation sequence locally in one command:
35+
36+
```bash
37+
bun run check
38+
```
39+
40+
## Deployment
41+
42+
The app deploys to **Cloudflare Pages/Workers**. The deploy configuration lives
43+
in `wrangler.jsonc`, which serves the built `dist/` directory as a static site
44+
with SPA routing (`not_found_handling: "single-page-application"`).
45+
46+
### Continuous deployment
47+
48+
Pushes to `main` trigger the CD workflow at `.github/workflows/deploy.yml`,
49+
which builds the app and deploys it via Wrangler.
50+
51+
**Required GitHub repository secrets:**
52+
53+
| Secret | Description |
54+
|--------|-------------|
55+
| `CLOUDFLARE_API_TOKEN` | API token with Workers Scripts:Edit permission |
56+
| `CLOUDFLARE_ACCOUNT_ID` | Your Cloudflare account ID |
57+
58+
### Manual deploy
59+
60+
To deploy manually from a local machine:
61+
62+
```bash
63+
bun run build
64+
wrangler login # one-time auth
65+
bun run deploy
66+
```
67+
68+
### Local production preview
69+
70+
To test the production build locally with Wrangler:
71+
72+
```bash
73+
bun run build
74+
bun run dev:wrangler -- --port 8787
75+
# Open http://localhost:8787/
76+
```
77+
78+
## Package manager
79+
80+
This repository uses a **Bun-first** workflow. Installing dependencies with
81+
`npm install` is intentionally blocked so the committed `bun.lock` remains the
82+
single source of truth for dependency resolution.

0 commit comments

Comments
 (0)