-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (66 loc) · 2.11 KB
/
front-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: CI
on:
push:
branches:
- 'fe/**' # fe/로 시작하는 모든 브랜치에 대해 푸시 이벤트 트리거
pull_request:
branches:
- main
- develop
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]
# PR의 소스 브랜치가 fe/로 시작하는 경우에만 실행
if: startsWith(github.head_ref, 'fe/') || startsWith(github.event.pull_request.head.ref, 'fe/')
steps:
# 1. 리포지토리 체크아웃
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # 전체 히스토리를 가져오도록 설정 (필요시)
# 2. frontend 디렉토리 내용 확인 (디버깅용)
- name: List frontend directory (Debug)
run: ls -la frontend/
# 3. Node.js 설정 (Yarn 캐싱 비활성화)
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# 4. Yarn 캐시 설정 (frontend/yarn.lock 기반)
- name: Cache Yarn dependencies
uses: actions/cache@v3
with:
path: ~/.cache/yarn
key: ${{ runner.os }}-yarn-${{ hashFiles('frontend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# 5. 의존성 설치
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: frontend
# 6. ESLint 실행
- name: Run ESLint
run: yarn lint
working-directory: frontend
# 7. 타입 체크
- name: Type Check
run: yarn type-check
working-directory: frontend
# 8. 테스트 실행
- name: Run Tests
run: yarn test --coverage
working-directory: frontend
# 9. 빌드 실행
- name: Build
run: yarn build
working-directory: frontend
# 10. 빌드 아티팩트 업로드
- name: Upload Artifacts
if: success()
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: frontend/build/