Skip to content

Commit 8bd3daa

Browse files
committed
feat(ci): add GitHub Actions CI workflow
1 parent b5743a4 commit 8bd3daa

2 files changed

Lines changed: 141 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, development]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
ci:
11+
name: CI
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 22
22+
23+
- name: Setup pnpm
24+
uses: pnpm/action-setup@v4
25+
with:
26+
run_install: false
27+
28+
- name: Get pnpm store directory
29+
id: pnpm-cache
30+
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
31+
32+
- name: Cache pnpm store
33+
uses: actions/cache@v4
34+
with:
35+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
36+
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
37+
restore-keys: |
38+
${{ runner.os }}-pnpm-
39+
40+
- name: Install dependencies
41+
run: pnpm install --frozen-lockfile
42+
43+
- name: Lint
44+
run: pnpm lint
45+
46+
- name: Format check
47+
run: pnpm exec biome format --check .
48+
49+
- name: Test
50+
run: pnpm test --ci
51+
52+
- name: Build
53+
run: pnpm build
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Design Spec: Vercel Deploy + GitHub Actions CI/CD
2+
3+
**Date:** 2026-03-23
4+
**Status:** Implemented
5+
6+
---
7+
8+
## Context
9+
10+
The Devmetry project (Next.js 16, React 19, pnpm, Biome.js, Jest) has no CI/CD or deployment setup. This spec covers:
11+
12+
- Deploying the app to Vercel with automatic preview deploys on PRs
13+
- A GitHub Actions pipeline that runs lint, format check, tests, and build before any merge to `main`
14+
- Branch protection on `main` so merges are blocked if CI fails
15+
16+
**Approach:** Vercel GitHub Integration + GitHub Actions CI + Branch Protection
17+
18+
- Vercel handles all deploys (auto, via OAuth GitHub integration, no secrets needed in CI)
19+
- GitHub Actions validates quality gates on every PR and push
20+
- Branch protection on `main` enforces CI must pass before merge
21+
22+
---
23+
24+
## Architecture
25+
26+
```
27+
Push/PR
28+
└── GitHub Actions (ci.yml) ← quality gate
29+
├── pnpm lint
30+
├── pnpm exec biome format --check .
31+
├── pnpm test --ci
32+
└── pnpm build
33+
34+
└── Vercel (GitHub Integration) ← auto deploy
35+
├── PR → Preview Deploy (unique URL per PR)
36+
└── Merge to main → Production Deploy
37+
38+
Branch Protection (main):
39+
└── Requires "CI" status check to pass before merge
40+
```
41+
42+
---
43+
44+
## Key Decisions
45+
46+
- `pnpm format` uses `--write` and is not safe for CI. Format check uses `pnpm exec biome format --check .` instead.
47+
- No environment variables needed — app is purely frontend.
48+
- Node 22 LTS, pnpm via corepack (`pnpm/action-setup@v4` reads `packageManager` from `package.json`).
49+
- pnpm store is cached by `pnpm-lock.yaml` hash to speed up installs.
50+
51+
---
52+
53+
## Files
54+
55+
| File | Purpose |
56+
|---|---|
57+
| `.github/workflows/ci.yml` | GitHub Actions CI pipeline |
58+
59+
---
60+
61+
## Manual Setup Steps
62+
63+
### Vercel
64+
65+
1. Go to vercel.com → Add New Project → Import Git Repository
66+
2. Select the `devmetry` GitHub repo
67+
3. Framework preset: Next.js (auto-detected)
68+
4. Production branch: `main`
69+
5. Deploy — Vercel will auto-configure GitHub integration (preview on PRs, production on `main`)
70+
71+
### GitHub Branch Protection
72+
73+
1. GitHub → repo → Settings → Branches → Add branch ruleset (or classic rule)
74+
2. Branch name pattern: `main`
75+
3. Enable: "Require status checks to pass before merging"
76+
4. Add required status check: `CI` (matches the job name in `ci.yml`)
77+
5. Enable: "Require branches to be up to date before merging"
78+
6. Save
79+
80+
---
81+
82+
## Verification
83+
84+
1. Push `ci.yml` to a branch and open a PR → GitHub shows the "CI" check running
85+
2. Introduce a lint error → CI fails, merge is blocked
86+
3. Fix and re-push → CI passes, merge is unblocked
87+
4. After Vercel is connected: open a PR → Vercel preview URL appears in PR checks
88+
5. Merge to `main` → Vercel production deploy triggers automatically

0 commit comments

Comments
 (0)