From 26ee0917c4aa89e47d40a7621e05dc64efdaf212 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A3=BC=EC=B0=AC?= Date: Fri, 20 Mar 2026 15:35:43 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20CI=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20=ED=9B=84=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_ci.yml | 87 +++++++++++++++++++ .github/workflows/frontend_ci.yml | 45 ++++++++++ .../com/prothsync/prothsync/UserTest.java | 10 +-- 3 files changed, 137 insertions(+), 5 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 8b13789..8d2849c 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1 +1,88 @@ +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: + SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/prothsync_test + SPRING_DATASOURCE_USERNAME: test + SPRING_DATASOURCE_PASSWORD: test + SPRING_DATA_REDIS_HOST: localhost + SPRING_DATA_REDIS_PORT: 6379 + JWT_SECRET: ci-test-secret-key-that-is-long-enough-for-hmac-sha256 + KAKAO_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/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 From 920572b315ea758d68bf242e23deec34e4c6c78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A3=BC=EC=B0=AC?= Date: Fri, 20 Mar 2026 15:46:48 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20CI=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=20=ED=9B=84=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_ci.yml | 14 +++++++------- .../com/prothsync/prothsync/entity/user/User.java | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 8d2849c..97205c0 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -31,10 +31,11 @@ jobs: redis: image: redis:7-alpine + command: redis-server --requirepass testpass ports: - 6379:6379 options: >- - --health-cmd="redis-cli ping" + --health-cmd="redis-cli -a testpass ping" --health-interval=10s --health-timeout=5s --health-retries=5 @@ -69,13 +70,12 @@ jobs: # 5) 빌드 + 테스트 실행 - name: Build & Test env: - SPRING_DATASOURCE_URL: jdbc:postgresql://localhost:5432/prothsync_test - SPRING_DATASOURCE_USERNAME: test - SPRING_DATASOURCE_PASSWORD: test - SPRING_DATA_REDIS_HOST: localhost - SPRING_DATA_REDIS_PORT: 6379 + POSTGRES_DB: prothsync_test + POSTGRES_USER: test + POSTGRES_PASSWORD: test + REDIS_PASSWORD: testpass JWT_SECRET: ci-test-secret-key-that-is-long-enough-for-hmac-sha256 - KAKAO_API_KEY: test-key + KAKAO_REST_API_KEY: test-key run: ./gradlew build # 6) 테스트 결과 리포트 업로드 (실패 시 디버깅용) 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; From 1076facd9956418df2f1872f3ce7f962b86c51c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A3=BC=EC=B0=AC?= Date: Fri, 20 Mar 2026 15:50:00 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20CI=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=8B=A4=ED=8C=A8=20=ED=9B=84=20=EC=BD=94=EB=93=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 97205c0..d5f7e42 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -31,11 +31,10 @@ jobs: redis: image: redis:7-alpine - command: redis-server --requirepass testpass ports: - 6379:6379 options: >- - --health-cmd="redis-cli -a testpass ping" + --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=5 @@ -73,7 +72,7 @@ jobs: POSTGRES_DB: prothsync_test POSTGRES_USER: test POSTGRES_PASSWORD: test - REDIS_PASSWORD: testpass + REDIS_PASSWORD: "" JWT_SECRET: ci-test-secret-key-that-is-long-enough-for-hmac-sha256 KAKAO_REST_API_KEY: test-key run: ./gradlew build