Skip to content

Commit

Permalink
fix: 의존성 캐시 설정 및 테스트 버전 개선
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolerblanc committed Nov 12, 2024
1 parent fe1551d commit 6931bc6
Showing 1 changed file with 66 additions and 51 deletions.
117 changes: 66 additions & 51 deletions .github/workflows/ci-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,81 +11,76 @@ on:
jobs:
setup-backend:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-backend-deps.outputs.cache-hit }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 설정
- name: Cache Yarn dependencies for backend
uses: actions/cache@v2
id: cache-backend-deps
uses: actions/cache@v3
with:
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('**/backend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-backend-yarn-
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 의존성 설치
- name: Install backend dependencies
if: steps.cache-backend-deps.outputs.cache-hit != 'true'
working-directory: ./backend
run: yarn install

# 백엔드 의존성 아티팩트 업로드
- name: Save backend node_modules as artifact
uses: actions/upload-artifact@v3 # Updated to v3
with:
name: backend_node_modules
path: backend/node_modules

setup-frontend:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-frontend-deps.outputs.cache-hit }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: "23"

# 프론트엔드 의존성 캐시 설정
- name: Cache Yarn dependencies for frontend
uses: actions/cache@v2
id: cache-frontend-deps
uses: actions/cache@v3
with:
path: frontend/node_modules
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('**/frontend/yarn.lock') }}
restore-keys: |
${{ runner.os }}-frontend-yarn-
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('frontend/yarn.lock') }}

# 프론트엔드 의존성 설치
- name: Install frontend dependencies
if: steps.cache-frontend-deps.outputs.cache-hit != 'true'
working-directory: ./frontend
run: yarn install

# 프론트엔드 의존성 아티팩트 업로드
- name: Save frontend node_modules as artifact
uses: actions/upload-artifact@v3 # Updated to v3
with:
name: frontend_node_modules
path: frontend/node_modules

backend-lint:
runs-on: ubuntu-latest
needs: setup-backend
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# 백엔드 의존성 아티팩트 다운로드
- name: Restore backend node_modules
uses: actions/download-artifact@v3 # Updated to v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for backend
uses: actions/cache@v3
with:
name: backend_node_modules
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 린트 실행
- name: Run backend lint
Expand All @@ -103,14 +98,19 @@ jobs:
needs: setup-frontend
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 프론트엔드 의존성 아티팩트 다운로드
- name: Restore frontend node_modules
uses: actions/download-artifact@v3 # Updated to v3
# 프론트엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for frontend
uses: actions/cache@v3
with:
name: frontend_node_modules
path: frontend/node_modules
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('frontend/yarn.lock') }}

# 프론트엔드 린트 실행
- name: Run frontend lint
Expand All @@ -128,14 +128,19 @@ jobs:
needs: setup-backend
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# 백엔드 의존성 아티팩트 다운로드
- name: Restore backend node_modules
uses: actions/download-artifact@v3 # Updated to v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for backend
uses: actions/cache@v3
with:
name: backend_node_modules
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 빌드 실행
- name: Run backend build
Expand All @@ -147,14 +152,19 @@ jobs:
needs: setup-frontend
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# 프론트엔드 의존성 아티팩트 다운로드
- name: Restore frontend node_modules
uses: actions/download-artifact@v3 # Updated to v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 프론트엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for frontend
uses: actions/cache@v3
with:
name: frontend_node_modules
path: frontend/node_modules
key: ${{ runner.os }}-frontend-yarn-${{ hashFiles('frontend/yarn.lock') }}

# 프론트엔드 빌드 실행
- name: Run frontend build
Expand All @@ -166,14 +176,19 @@ jobs:
needs: [setup-backend, backend-build]
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "23"

# 백엔드 의존성 아티팩트 다운로드
- name: Restore backend node_modules
uses: actions/download-artifact@v3 # Updated to v3
# 백엔드 의존성 캐시 복원
- name: Restore Yarn dependencies for backend
uses: actions/cache@v3
with:
name: backend_node_modules
path: backend/node_modules
key: ${{ runner.os }}-backend-yarn-${{ hashFiles('backend/yarn.lock') }}

# 백엔드 테스트 실행
- name: Run backend tests
Expand Down

0 comments on commit 6931bc6

Please sign in to comment.