Skip to content

Commit b7e1b41

Browse files
committed
refactor: CI turbo로 프론트, 백엔드 동시 수행
1 parent b5a320d commit b7e1b41

File tree

3 files changed

+121
-122
lines changed

3 files changed

+121
-122
lines changed

.github/workflows/ci-pipeline.yml

Lines changed: 116 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -22,48 +22,47 @@ jobs:
2222
with:
2323
node-version: "23"
2424

25-
# 백엔드 의존성 캐시 설정
25+
# turbo 의존성 캐시 설정
2626
- name: Cache Yarn dependencies for backend
27-
id: cache-backend-deps
27+
id: cache-deps
2828
uses: actions/cache@v3
2929
with:
30-
path: apps/backend/node_modules
31-
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('apps/backend/yarn.lock') }}
30+
path: node_modules
31+
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('yarn.lock') }}
3232

33-
# 백엔드 의존성 설치
33+
# turbo 의존성 설치
3434
- name: Install backend dependencies
35-
if: steps.cache-backend-deps.outputs.cache-hit != 'true'
36-
working-directory: ./apps/backend
37-
run: yarn install
38-
39-
setup-frontend:
40-
runs-on: ubuntu-latest
41-
outputs:
42-
cache-key: ${{ steps.cache-frontend-deps.outputs.cache-hit }}
43-
steps:
44-
- name: Checkout repository
45-
uses: actions/checkout@v3
46-
47-
- name: Set up Node.js
48-
uses: actions/setup-node@v3
49-
with:
50-
node-version: "23"
51-
52-
# 프론트엔드 의존성 캐시 설정
53-
- name: Cache Yarn dependencies for frontend
54-
id: cache-frontend-deps
55-
uses: actions/cache@v3
56-
with:
57-
path: apps/frontend/node_modules
58-
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('apps/frontend/yarn.lock') }}
59-
60-
# 프론트엔드 의존성 설치
61-
- name: Install frontend dependencies
62-
if: steps.cache-frontend-deps.outputs.cache-hit != 'true'
63-
working-directory: ./apps/frontend
35+
if: steps.cache-deps.outputs.cache-hit != 'true'
6436
run: yarn install
6537

66-
backend-lint:
38+
# setup:
39+
# runs-on: ubuntu-latest
40+
# outputs:
41+
# cache-key: ${{ steps.cache-deps.outputs.cache-hit }}
42+
# steps:
43+
# - name: Checkout repository
44+
# uses: actions/checkout@v3
45+
46+
# - name: Set up Node.js
47+
# uses: actions/setup-node@v3
48+
# with:
49+
# node-version: "23"
50+
51+
# # 프론트엔드 의존성 캐시 설정
52+
# - name: Cache Yarn dependencies for frontend
53+
# id: cache-deps
54+
# uses: actions/cache@v3
55+
# with:
56+
# path: node_modules
57+
# key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('yarn.lock') }}
58+
59+
# # 프론트엔드 의존성 설치
60+
# - name: Install frontend dependencies
61+
# if: steps.cache-frontend-deps.outputs.cache-hit != 'true'
62+
# working-directory: ./apps/frontend
63+
# run: yarn install
64+
65+
lint:
6766
runs-on: ubuntu-latest
6867
needs: setup-backend
6968
steps:
@@ -75,57 +74,56 @@ jobs:
7574
with:
7675
node-version: "23"
7776

78-
# 백엔드 의존성 캐시 복원
77+
# 의존성 캐시 복원
7978
- name: Restore Yarn dependencies for backend
8079
uses: actions/cache@v3
8180
with:
82-
path: apps/backend/node_modules
83-
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('apps/backend/yarn.lock') }}
81+
path: node_modules
82+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
8483

8584
# 백엔드 린트 실행
86-
- name: Run backend lint
87-
working-directory: ./apps/backend
85+
- name: Run lint
8886
run: yarn lint
8987
continue-on-error: true
9088

9189
# 백엔드 린트 경고 포스트
9290
- name: Post backend lint warning if any
9391
if: failure()
94-
run: echo "⚠️ 백엔드 lint 실행 도중 경고가 발생했습니다. 확인해주세요."
95-
96-
frontend-lint:
97-
runs-on: ubuntu-latest
98-
needs: setup-frontend
99-
steps:
100-
- name: Checkout repository
101-
uses: actions/checkout@v3
102-
103-
- name: Set up Node.js
104-
uses: actions/setup-node@v3
105-
with:
106-
node-version: "23"
107-
108-
# 프론트엔드 의존성 캐시 복원
109-
- name: Restore Yarn dependencies for frontend
110-
uses: actions/cache@v3
111-
with:
112-
path: apps/frontend/node_modules
113-
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('apps/frontend/yarn.lock') }}
114-
115-
# 프론트엔드 린트 실행
116-
- name: Run frontend lint
117-
working-directory: ./apps/frontend
118-
run: yarn lint
119-
continue-on-error: true
120-
121-
# 프론트엔드 린트 경고 포스트
122-
- name: Post frontend lint warning if any
123-
if: failure()
124-
run: echo "⚠️ 프론트엔드 lint 실행 도중 경고가 발생했습니다. 확인해주세요."
125-
126-
backend-build:
92+
run: echo "⚠️ lint 실행 도중 경고가 발생했습니다. 확인해주세요."
93+
94+
# frontend-lint:
95+
# runs-on: ubuntu-latest
96+
# needs: setup-frontend
97+
# steps:
98+
# - name: Checkout repository
99+
# uses: actions/checkout@v3
100+
101+
# - name: Set up Node.js
102+
# uses: actions/setup-node@v3
103+
# with:
104+
# node-version: "23"
105+
106+
# # 프론트엔드 의존성 캐시 복원
107+
# - name: Restore Yarn dependencies for frontend
108+
# uses: actions/cache@v3
109+
# with:
110+
# path: apps/frontend/node_modules
111+
# key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('apps/frontend/yarn.lock') }}
112+
113+
# # 프론트엔드 린트 실행
114+
# - name: Run frontend lint
115+
# working-directory: ./apps/frontend
116+
# run: yarn lint
117+
# continue-on-error: true
118+
119+
# # 프론트엔드 린트 경고 포스트
120+
# - name: Post frontend lint warning if any
121+
# if: failure()
122+
# run: echo "⚠️ 프론트엔드 lint 실행 도중 경고가 발생했습니다. 확인해주세요."
123+
124+
build:
127125
runs-on: ubuntu-latest
128-
needs: setup-backend
126+
needs: setup
129127
steps:
130128
- name: Checkout repository
131129
uses: actions/checkout@v3
@@ -136,54 +134,53 @@ jobs:
136134
node-version: "23"
137135
# 루트 의존성 캐시 설정
138136
- name: Cache Yarn dependencies for root
139-
id: cache-root-deps
137+
id: cache-deps
140138
uses: actions/cache@v3
141139
with:
142140
path: node_modules
143-
key: ${{ runner.os }}-root-yarn-${{ hashFiles('yarn.lock') }}
141+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
144142

145143
# 루트 의존성 설치
146-
- name: Install root dependencies
147-
if: steps.cache-root-deps.outputs.cache-hit != 'true'
148-
run: yarn install
149-
150-
# 백엔드 의존성 캐시 복원
151-
- name: Restore Yarn dependencies for backend
152-
uses: actions/cache@v3
153-
with:
154-
path: apps/backend/node_modules
155-
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('apps/backend/yarn.lock') }}
156-
157-
# 백엔드 빌드 실행
158-
- name: Run backend build
159-
working-directory: ./apps/backend
160-
run: yarn build
144+
# - name: Install root dependencies
145+
# if: steps.cache-root-deps.outputs.cache-hit != 'true'
146+
# run: yarn install
161147

162-
frontend-build:
163-
runs-on: ubuntu-latest
164-
needs: setup-frontend
165-
steps:
166-
- name: Checkout repository
167-
uses: actions/checkout@v3
148+
# # 백엔드 의존성 캐시 복원
149+
# - name: Restore Yarn dependencies for backend
150+
# uses: actions/cache@v3
151+
# with:
152+
# path: apps/backend/node_modules
153+
# key: ${{ runner.os }}-backend-yarn-${{ hashFiles('apps/backend/yarn.lock') }}
168154

169-
- name: Set up Node.js
170-
uses: actions/setup-node@v3
171-
with:
172-
node-version: "23"
173-
174-
# 프론트엔드 의존성 캐시 복원
175-
- name: Restore Yarn dependencies for frontend
176-
uses: actions/cache@v3
177-
with:
178-
path: apps/frontend/node_modules
179-
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('apps/frontend/yarn.lock') }}
180-
181-
# 프론트엔드 빌드 실행
182-
- name: Run frontend build
183-
working-directory: ./apps/frontend
155+
# 백엔드 빌드 실행
156+
- name: Run build
184157
run: yarn build
185158

186-
backend-test:
159+
# frontend-build:
160+
# runs-on: ubuntu-latest
161+
# needs: setup-frontend
162+
# steps:
163+
# - name: Checkout repository
164+
# uses: actions/checkout@v3
165+
166+
# - name: Set up Node.js
167+
# uses: actions/setup-node@v3
168+
# with:
169+
# node-version: "23"
170+
171+
# # 프론트엔드 의존성 캐시 복원
172+
# - name: Restore Yarn dependencies for frontend
173+
# uses: actions/cache@v3
174+
# with:
175+
# path: apps/frontend/node_modules
176+
# key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('apps/frontend/yarn.lock') }}
177+
178+
# # 프론트엔드 빌드 실행
179+
# - name: Run frontend build
180+
# working-directory: ./apps/frontend
181+
# run: yarn build
182+
183+
test:
187184
runs-on: ubuntu-latest
188185
needs: [setup-backend, backend-build]
189186
steps:
@@ -195,14 +192,13 @@ jobs:
195192
with:
196193
node-version: "23"
197194

198-
# 백엔드 의존성 캐시 복원
199-
- name: Restore Yarn dependencies for backend
195+
# 의존성 캐시 복원
196+
- name: Restore Yarn dependencies
200197
uses: actions/cache@v3
201198
with:
202-
path: apps/backend/node_modules
203-
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('apps/backend/yarn.lock') }}
199+
path: node_modules
200+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
204201

205-
# 백엔드 테스트 실행
206-
- name: Run backend tests
207-
working-directory: ./apps/backend
202+
# 테스트 실행
203+
- name: Run tests
208204
run: yarn test

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"dev": "turbo run dev",
1010
"build": "turbo run build",
1111
"start": "node apps/backend/dist/main.js",
12-
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix"
12+
"lint": "turbo run lint",
13+
"test": "turbo run test"
1314
},
1415
"dependencies": {
1516
"turbo": "^2.3.0"

turbo.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"outputs": [
1212
"dist/**"
1313
]
14-
}
14+
},
15+
"lint": {},
16+
"test": {}
1517
}
1618
}

0 commit comments

Comments
 (0)