modified: frontend/src/components/common/Navbar.tsx #468
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- 'fe/**' # fe/로 시작하는 모든 브랜치에 대해 푸시 이벤트 트리거 | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20.x] # Node.js 버전을 18.x와 20.x로 업데이트 | |
# PR의 소스 브랜치가 fe/로 시작하고, 커밋 주체가 GitHub Actions가 아닌 경우에만 실행 | |
if: > | |
(startsWith(github.head_ref, 'fe/') || | |
(github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'fe/'))) && | |
github.actor != 'github-actions[bot]' && | |
!contains(github.event.head_commit.message, '[skip ci]') | |
steps: | |
# 1. 리포지토리 체크아웃 | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # 전체 히스토리를 가져옵니다. | |
# 2. frontend 디렉토리 내용 확인 (디버깅용) | |
- name: List frontend directory (Debug) | |
run: | | |
echo "Listing frontend directory:" | |
ls -la frontend/ | |
echo "Checking yarn.lock:" | |
ls -la frontend/yarn.lock | |
# 3. Node.js 설정 | |
- 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. Prettier 자동 수정 및 커밋 | |
- name: Run Prettier and commit changes if any | |
run: | | |
# Prettier로 코드 포맷팅 | |
yarn prettier --write "src/**/*.{js,jsx,ts,tsx,css,scss,md}" | |
# 변경 사항이 있는지 확인 | |
if [[ `git status --porcelain` ]]; then | |
# Git 사용자 설정 | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
# 변경 사항 커밋 | |
git add . | |
git commit -m "chore: auto-format code [skip ci]" | |
# 현재 브랜치 이름 가져오기 | |
if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then | |
BRANCH_NAME=${GITHUB_HEAD_REF} | |
else | |
BRANCH_NAME=$(echo "${GITHUB_REF#refs/heads/}") | |
fi | |
# 변경 사항 푸시 | |
git push origin HEAD:${BRANCH_NAME} | |
fi | |
working-directory: frontend | |
# 8. 타입 체크 | |
- name: Type Check | |
run: yarn type-check | |
working-directory: frontend | |
# # 9. 테스트 실행 | |
# - name: Run Tests | |
# run: yarn test --coverage | |
# working-directory: frontend | |
# 10. 빌드 실행 | |
- name: Build | |
run: yarn build | |
working-directory: frontend | |
# # 11. 빌드 아티팩트 업로드 | |
# - name: Upload Artifacts | |
# if: success() | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: build-artifacts | |
# path: frontend/build/ |