diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 8b13789..d5f7e42 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1 +1,87 @@ +name: Backend CI +on: + pull_request: + branches: [master, dev] + paths: + - "prothsync/**" + +defaults: + run: + working-directory: prothsync + +jobs: + build: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:18 + env: + POSTGRES_DB: prothsync_test + POSTGRES_USER: test + POSTGRES_PASSWORD: test + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready -U test" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + redis: + image: redis:7-alpine + ports: + - 6379:6379 + options: >- + --health-cmd="redis-cli ping" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + steps: + # 1) 소스 체크아웃 + - name: Checkout repository + uses: actions/checkout@v4 + + # 2) Java 17 설정 + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + # 3) Gradle 캐시 (빌드 속도 향상) + - name: Cache Gradle packages + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('prothsync/**/*.gradle*', 'prothsync/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + + # 4) Gradle 실행 권한 부여 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + # 5) 빌드 + 테스트 실행 + - name: Build & Test + env: + POSTGRES_DB: prothsync_test + POSTGRES_USER: test + POSTGRES_PASSWORD: test + REDIS_PASSWORD: "" + JWT_SECRET: ci-test-secret-key-that-is-long-enough-for-hmac-sha256 + KAKAO_REST_API_KEY: test-key + run: ./gradlew build + + # 6) 테스트 결과 리포트 업로드 (실패 시 디버깅용) + - name: Upload test reports + if: failure() + uses: actions/upload-artifact@v4 + with: + name: backend-test-reports + path: prothsync/build/reports/tests/ + retention-days: 7 diff --git a/.github/workflows/frontend_ci.yml b/.github/workflows/frontend_ci.yml index 8b13789..79826f0 100644 --- a/.github/workflows/frontend_ci.yml +++ b/.github/workflows/frontend_ci.yml @@ -1 +1,46 @@ +name: Frontend CI +on: + pull_request: + branches: [master, dev] + paths: + - "prothsyncFront/**" + +defaults: + run: + working-directory: prothsyncFront + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # 1) 소스 체크아웃 + - name: Checkout repository + uses: actions/checkout@v4 + + # 2) Node.js 설정 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + cache-dependency-path: prothsyncFront/package-lock.json + + # 3) 의존성 설치 (CI 환경에서는 npm ci 사용) + - name: Install dependencies + run: npm ci + + # 4) 빌드 검증 + - name: Build + run: npm run build + + # ── 아래는 나중에 추가할 때 주석 해제 ── + + # 5) ESLint (lint 설정 후 활성화) + # - name: Lint + # run: npm run lint + + # 6) 테스트 (Vitest 등 설정 후 활성화) + # - name: Test + # run: npm run test diff --git a/prothsync/src/main/java/com/prothsync/prothsync/entity/user/User.java b/prothsync/src/main/java/com/prothsync/prothsync/entity/user/User.java index bbf2fd0..afabd8c 100644 --- a/prothsync/src/main/java/com/prothsync/prothsync/entity/user/User.java +++ b/prothsync/src/main/java/com/prothsync/prothsync/entity/user/User.java @@ -27,7 +27,7 @@ public class User extends BaseEntity { private static final Pattern EMAIL_PATTERN = - Pattern.compile("^[A-Za-z0-9+_.-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$"); + Pattern.compile("^[A-Za-z0-9+_]+([.-][A-Za-z0-9+_]+)*@[A-Za-z0-9]+([.-][A-Za-z0-9]+)*\\.[A-Za-z]{2,}$"); private static final int BIO_MAX_LENGTH = 200; diff --git a/prothsync/src/test/java/com/prothsync/prothsync/UserTest.java b/prothsync/src/test/java/com/prothsync/prothsync/UserTest.java index 86f0355..ab959b4 100644 --- a/prothsync/src/test/java/com/prothsync/prothsync/UserTest.java +++ b/prothsync/src/test/java/com/prothsync/prothsync/UserTest.java @@ -25,7 +25,7 @@ class UserTest { private static final LocalDate VALID_BIRTHDAY = LocalDate.of(1990, 1, 1); private static final String VALID_ADDRESS = "서울시 강남구 테헤란로 123"; private static final String VALID_EMAIL = "test@example.com"; - private static final UserType VALID_USER_TYPE = UserType.DENTIST; + private static final UserType VALID_USER_TYPE = UserType.DENTAL_CLINIC; @Nested @DisplayName("사용자 생성 테스트") @@ -468,11 +468,11 @@ void createUser_WithDentistType_Success() { VALID_BIRTHDAY, VALID_ADDRESS, VALID_EMAIL, - UserType.DENTIST + UserType.DENTAL_CLINIC ); // then - assertThat(user.getUserType()).isEqualTo(UserType.DENTIST); + assertThat(user.getUserType()).isEqualTo(UserType.DENTAL_CLINIC); } @Test @@ -486,11 +486,11 @@ void createUser_WithDentalLabOwnerType_Success() { VALID_BIRTHDAY, VALID_ADDRESS, VALID_EMAIL, - UserType.DENTAL_LAB_OWNER + UserType.DENTAL_LAB ); // then - assertThat(user.getUserType()).isEqualTo(UserType.DENTAL_LAB_OWNER); + assertThat(user.getUserType()).isEqualTo(UserType.DENTAL_LAB); } @Test