Skip to content

Commit f56fac7

Browse files
committed
feat: optimize monorepo with auto PR labeling, CI improvements, and shared configs
1 parent 60778c3 commit f56fac7

10 files changed

Lines changed: 408 additions & 123 deletions

File tree

.env.guide.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Environment Variables Setup Guide
22

3+
## Monorepo Structure
4+
5+
이 프로젝트는 모노레포 구조로 web과 admin 앱을 포함합니다:
6+
7+
- **apps/web**: Next.js 기반 웹 애플리케이션 (`NEXT_PUBLIC_*` 환경 변수)
8+
- **apps/admin**: Vite 기반 어드민 애플리케이션 (`VITE_*` 환경 변수)
9+
10+
각 앱은 독립적인 환경 변수를 가지며, 공통 빌드 도구 설정은 `packages/config`에서 관리됩니다.
11+
12+
---
13+
314
## Architecture Decision
415

516
### Why Only .env.development and .env.production?

.github/workflows/ci.yml

Lines changed: 107 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,40 @@ on:
77
branches: [main, develop]
88

99
jobs:
10-
quality-check:
11-
name: Code Quality Check
10+
# 변경 감지
11+
detect-changes:
12+
name: Detect Changes
1213
runs-on: ubuntu-latest
14+
outputs:
15+
web: ${{ steps.filter.outputs.web }}
16+
admin: ${{ steps.filter.outputs.admin }}
17+
root: ${{ steps.filter.outputs.root }}
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Check changed files
23+
uses: dorny/paths-filter@v3
24+
id: filter
25+
with:
26+
filters: |
27+
web:
28+
- 'apps/web/**'
29+
admin:
30+
- 'apps/admin/**'
31+
root:
32+
- 'package.json'
33+
- 'pnpm-lock.yaml'
34+
- 'pnpm-workspace.yaml'
35+
- 'turbo.json'
36+
- '.github/workflows/**'
37+
38+
# Web 앱 품질 체크
39+
web-quality-check:
40+
name: Web - Quality Check
41+
runs-on: ubuntu-latest
42+
needs: detect-changes
43+
if: needs.detect-changes.outputs.web == 'true' || needs.detect-changes.outputs.root == 'true'
1344
steps:
1445
- name: Checkout repository
1546
uses: actions/checkout@v4
@@ -28,13 +59,80 @@ jobs:
2859
- name: Install dependencies
2960
run: pnpm install --frozen-lockfile
3061

31-
- name: Run Biome (lint & format) & TypeScript
32-
run: pnpm run ci:check
62+
- name: Run checks (lint & typecheck)
63+
run: pnpm --filter @solid-connect/web run ci:check
64+
65+
# Admin 앱 품질 체크
66+
admin-quality-check:
67+
name: Admin - Quality Check
68+
runs-on: ubuntu-latest
69+
needs: detect-changes
70+
if: needs.detect-changes.outputs.admin == 'true' || needs.detect-changes.outputs.root == 'true'
71+
steps:
72+
- name: Checkout repository
73+
uses: actions/checkout@v4
74+
75+
- name: Install pnpm
76+
uses: pnpm/action-setup@v3
77+
with:
78+
version: 9
79+
80+
- name: Setup Node.js
81+
uses: actions/setup-node@v4
82+
with:
83+
node-version: "22.x"
84+
cache: "pnpm"
85+
86+
- name: Install dependencies
87+
run: pnpm install --frozen-lockfile
88+
89+
- name: Run lint check
90+
run: pnpm --filter @solid-connect/admin run lint
91+
92+
- name: Run format check
93+
run: pnpm --filter @solid-connect/admin run format
94+
95+
# Web 앱 빌드
96+
web-build:
97+
name: Web - Build
98+
runs-on: ubuntu-latest
99+
needs: [detect-changes, web-quality-check]
100+
if: |
101+
always() &&
102+
(needs.detect-changes.outputs.web == 'true' || needs.detect-changes.outputs.root == 'true') &&
103+
needs.web-quality-check.result == 'success'
104+
steps:
105+
- name: Checkout repository
106+
uses: actions/checkout@v4
107+
108+
- name: Install pnpm
109+
uses: pnpm/action-setup@v3
110+
with:
111+
version: 9
112+
113+
- name: Setup Node.js
114+
uses: actions/setup-node@v4
115+
with:
116+
node-version: "22.x"
117+
cache: "pnpm"
118+
119+
- name: Install dependencies
120+
run: pnpm install --frozen-lockfile
121+
122+
- name: Build web application
123+
run: pnpm --filter @solid-connect/web run build
124+
env:
125+
NODE_ENV: production
33126

34-
build:
35-
name: Build Verification
127+
# Admin 앱 빌드
128+
admin-build:
129+
name: Admin - Build
36130
runs-on: ubuntu-latest
37-
needs: quality-check
131+
needs: [detect-changes, admin-quality-check]
132+
if: |
133+
always() &&
134+
(needs.detect-changes.outputs.admin == 'true' || needs.detect-changes.outputs.root == 'true') &&
135+
needs.admin-quality-check.result == 'success'
38136
steps:
39137
- name: Checkout repository
40138
uses: actions/checkout@v4
@@ -53,7 +151,7 @@ jobs:
53151
- name: Install dependencies
54152
run: pnpm install --frozen-lockfile
55153

56-
- name: Build Next.js application
57-
run: pnpm run build
154+
- name: Build admin application
155+
run: pnpm --filter @solid-connect/admin run build
58156
env:
59157
NODE_ENV: production
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Auto Label PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
label:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Detect changed apps
21+
id: detect
22+
run: |
23+
# Get changed files between base and head
24+
BASE_SHA="${{ github.event.pull_request.base.sha }}"
25+
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
26+
27+
FILES=$(git diff --name-only $BASE_SHA $HEAD_SHA)
28+
29+
echo "Changed files:"
30+
echo "$FILES"
31+
32+
# Check for web changes
33+
if echo "$FILES" | grep -q "^apps/web/"; then
34+
echo "web=true" >> $GITHUB_OUTPUT
35+
echo "✓ Detected changes in apps/web"
36+
else
37+
echo "web=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
# Check for admin changes
41+
if echo "$FILES" | grep -q "^apps/admin/"; then
42+
echo "admin=true" >> $GITHUB_OUTPUT
43+
echo "✓ Detected changes in apps/admin"
44+
else
45+
echo "admin=false" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Add labels
49+
uses: actions/github-script@v7
50+
with:
51+
github-token: ${{ secrets.GITHUB_TOKEN }}
52+
script: |
53+
const labels = [];
54+
55+
if ('${{ steps.detect.outputs.web }}' === 'true') {
56+
labels.push('web');
57+
}
58+
59+
if ('${{ steps.detect.outputs.admin }}' === 'true') {
60+
labels.push('admin');
61+
}
62+
63+
if (labels.length > 0) {
64+
console.log(`Adding labels: ${labels.join(', ')}`);
65+
66+
await github.rest.issues.addLabels({
67+
owner: context.repo.owner,
68+
repo: context.repo.repo,
69+
issue_number: context.issue.number,
70+
labels: labels
71+
});
72+
} else {
73+
console.log('No app-specific changes detected');
74+
}

apps/admin/biome.json

Lines changed: 40 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,42 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
3-
"vcs": {
4-
"enabled": false,
5-
"clientKind": "git",
6-
"useIgnoreFile": false
7-
},
8-
"files": {
9-
"ignoreUnknown": false,
10-
"includes": [
11-
"**/src/**/*",
12-
"**/.vscode/**/*",
13-
"**/index.html",
14-
"**/vite.config.ts",
15-
"!**/src/routeTree.gen.ts",
16-
"!**/src/styles.css"
17-
]
18-
},
19-
"formatter": {
20-
"enabled": true,
21-
"indentStyle": "tab"
22-
},
23-
"assist": { "actions": { "source": { "organizeImports": "on" } } },
24-
"linter": {
25-
"enabled": true,
26-
"rules": {
27-
"recommended": true
28-
}
29-
},
30-
"javascript": {
31-
"formatter": {
32-
"quoteStyle": "double"
33-
}
34-
}
2+
"$schema": "https://biomejs.dev/schemas/2.3.12/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"includes": [
11+
"**/src/**/*",
12+
"**/.vscode/**/*",
13+
"**/index.html",
14+
"**/vite.config.ts",
15+
"!**/src/routeTree.gen.ts",
16+
"!**/src/styles.css"
17+
]
18+
},
19+
"formatter": {
20+
"enabled": true,
21+
"indentStyle": "tab",
22+
"lineWidth": 120
23+
},
24+
"assist": {
25+
"actions": {
26+
"source": {
27+
"organizeImports": "on"
28+
}
29+
}
30+
},
31+
"linter": {
32+
"enabled": true,
33+
"rules": {
34+
"recommended": true
35+
}
36+
},
37+
"javascript": {
38+
"formatter": {
39+
"quoteStyle": "double"
40+
}
41+
}
3542
}
36-

0 commit comments

Comments
 (0)