From 6931bc6d703077400797a61258a4daf0e8d0b50a Mon Sep 17 00:00:00 2001 From: Hyunjun KIM Date: Tue, 12 Nov 2024 22:24:21 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9D=98=EC=A1=B4=EC=84=B1=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=20=EC=84=A4=EC=A0=95=20=EB=B0=8F=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20=EB=B2=84=EC=A0=84=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-pipeline.yml | 117 +++++++++++++++++------------- 1 file changed, 66 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index 90d81dea..c1623fc8 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -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 @@ -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 @@ -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 @@ -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 @@ -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