From 6dc1d140dd12e7abb7e3212d0ac703b36d47501a Mon Sep 17 00:00:00 2001 From: songhyeonpk Date: Sun, 15 Jun 2025 17:25:43 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=ED=94=84=EB=A1=9C=EC=A0=9D=ED=8A=B8?= =?UTF-8?q?=20=EC=84=B8=ED=8C=85=20(#1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: 이슈 템플릿 세팅 (bug, chore, documentation, feature, refactor) * chore: PR 템플릿 세팅 * chore: .gitignore .DS_store 파일 등록 * chore: 주석 처리된 Flyway, AWS S3 dependency 및 관련 설정 제거 (추후 필요 시 다시 추가 예정) * chore: 환경별 설정 세팅 * chore: develop pull request 워크플로우 구성 * chore: Test 클래스에 active profile, auto configure test database 설정 세팅 --- .github/ISSUE_TEMPLATE/bug.md | 28 +++++++++++ .github/ISSUE_TEMPLATE/chore.md | 27 ++++++++++ .github/ISSUE_TEMPLATE/documentation.md | 27 ++++++++++ .github/ISSUE_TEMPLATE/feature.md | 27 ++++++++++ .github/ISSUE_TEMPLATE/refactor.md | 27 ++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 23 +++++++++ .github/workflows/develop_pull_request.yml | 49 +++++++++++++++++++ .gitignore | 3 ++ build.gradle | 9 ---- .../ject/studytrip/StudytripApplication.java | 1 - src/main/resources/application-datasource.yml | 6 +-- src/main/resources/application-dev.yml | 9 ++++ src/main/resources/application-local.yml | 15 ++++++ src/main/resources/application-prod.yml | 4 ++ src/main/resources/application-security.yml | 13 +++++ src/main/resources/application-storage.yml | 4 -- src/main/resources/application.yml | 15 +++++- .../studytrip/StudytripApplicationTests.java | 7 ++- src/test/resources/application-test.yml | 9 ++++ 19 files changed, 283 insertions(+), 20 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug.md create mode 100644 .github/ISSUE_TEMPLATE/chore.md create mode 100644 .github/ISSUE_TEMPLATE/documentation.md create mode 100644 .github/ISSUE_TEMPLATE/feature.md create mode 100644 .github/ISSUE_TEMPLATE/refactor.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/develop_pull_request.yml delete mode 100644 src/main/resources/application-storage.yml diff --git a/.github/ISSUE_TEMPLATE/bug.md b/.github/ISSUE_TEMPLATE/bug.md new file mode 100644 index 0000000..8be29bc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.md @@ -0,0 +1,28 @@ +--- +name: "🐛️ Bug" +description: "버그 발견 및 수정/해결" +title: "🐛️[BUG]: " +labels: "🐛bug" +assignees: '' + +--- + +## 📌 버그 설명 + + +- + +
+ +## ✅ 수정할 항목 + +- [ ] +- [ ] + +
+ +## 💬 기타 참고 사항 (선택) + + + +- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/chore.md b/.github/ISSUE_TEMPLATE/chore.md new file mode 100644 index 0000000..80b6784 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/chore.md @@ -0,0 +1,27 @@ +--- +name: "⚙️ Chore" +description: "세팅 및 설정, 빌드, CICD 관련 작업" +title: "⚙️[CHORE]: " +labels: "⚙️chore" +assignees: '' + +--- + +## 📌 작업 개요 + + +- + +
+ +## ✅ 작업 항목 + +- [ ] +- [ ] + +
+ +## 💬 기타 참고 사항 (선택) + + +- diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md new file mode 100644 index 0000000..f0339ed --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.md @@ -0,0 +1,27 @@ +--- +name: "📄 Documentation" +description: "문서화 작업" +title: "📄[DOCS]: " +labels: "📃docs" +assignees: '' + +--- + +## 📌 문서 내용 개요 + + +- + +
+ +## ✅ 작업 항목 + +- [ ] +- [ ] + +
+ +## 💬 기타 참고 사항 (선택) + + +- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature.md b/.github/ISSUE_TEMPLATE/feature.md new file mode 100644 index 0000000..91bed0e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.md @@ -0,0 +1,27 @@ +--- +name: "✨ Feature" +description: "새로운 기능 개발 및 수정" +title: "✨[Feature]: " +labels: "✨feature" +assignees: '' + +--- + +## 📌 기능 설명 + + +- + +
+ +## ✅ 구현할 기능 목록 + +- [ ] +- [ ] + +
+ +## 💬 기타 참고 사항 (선택) + + +- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/refactor.md b/.github/ISSUE_TEMPLATE/refactor.md new file mode 100644 index 0000000..40e8a4b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/refactor.md @@ -0,0 +1,27 @@ +--- +name: "🪄 Refactor" +description: "기능 개선 및 기존 코드 리팩토링" +title: "🪄[REFACTOR]: " +labels: "🪄refactor" +assignees: '' + +--- + +## 📌 리팩토링 설명 + + +- + +
+ +## ✅ 작업 항목 + +- [ ] +- [ ] + +
+ +## 💬 기타 참고 사항 (선택) + + +- \ No newline at end of file diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..5e14901 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,23 @@ +## 📌 작업 내용 및 특이사항 + +- + +
+ +## 🌱 관련 이슈 + + +- close # + +
+ +## 🔍 참고사항(선택) + +- + +
+ +## 📚 기타(선택) + + +- \ No newline at end of file diff --git a/.github/workflows/develop_pull_request.yml b/.github/workflows/develop_pull_request.yml new file mode 100644 index 0000000..1cb5ddc --- /dev/null +++ b/.github/workflows/develop_pull_request.yml @@ -0,0 +1,49 @@ +name: develop pull request Check and Test + +on: + pull_request: + branches: [ "develop" ] + +jobs: + test: + runs-on: ubuntu-latest + env: + DB_NAME: ${{ secrets.DATABASE_NAME }} + DB_USERNAME: ${{ secrets.DATABASE_USERNAME }} + DB_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} + + strategy: + matrix: + java-version: [ 17 ] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java-version }} + distribution: 'temurin' + + - name: Run MySQL with Docker + run: | + docker run -d \ + --name mysql \ + -e MYSQL_ROOT_PASSWORD=$DB_PASSWORD \ + -e MYSQL_DATABASE=$DB_NAME \ + -p 3306:3306 \ + mysql:8.0 + + - name: Run Redis with Docker + run: | + docker run -d \ + --name redis \ + -p 6379:6379 \ + redis:7.0 + + - name: Grant Execute Permission for Gradlew + run: chmod +x ./gradlew + + - name: Run Gradle Check + run: ./gradlew check diff --git a/.gitignore b/.gitignore index d221371..c93ca88 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,8 @@ out/ ### VS Code ### .vscode/ +### +.DS_Store + ### ENV *.env \ No newline at end of file diff --git a/build.gradle b/build.gradle index 15d6eb9..13a8a26 100644 --- a/build.gradle +++ b/build.gradle @@ -34,10 +34,6 @@ dependencies { annotationProcessor 'org.projectlombok:lombok' runtimeOnly 'com.mysql:mysql-connector-j' - // Flyway (Database Migration Tools) - //implementation 'org.flywaydb:flyway-core' - //implementation 'org.flywaydb:flyway-mysql' - // Validation implementation 'org.springframework.boot:spring-boot-starter-validation' @@ -58,11 +54,6 @@ dependencies { // Redis implementation 'org.springframework.boot:spring-boot-starter-data-redis' - // AWS - //implementation 'software.amazon.awssdk:s3:2.20.140' // 최신 버전 확인 후 적용 - //implementation 'software.amazon.awssdk:auth:2.20.140' // IAM 인증 관련 - //implementation 'software.amazon.awssdk:sts:2.20.140' // STS (IAM Role 인증 필요시) - // Firebase-admin implementation 'com.google.firebase:firebase-admin:9.2.0' diff --git a/src/main/java/com/ject/studytrip/StudytripApplication.java b/src/main/java/com/ject/studytrip/StudytripApplication.java index 1f5c011..c58013a 100644 --- a/src/main/java/com/ject/studytrip/StudytripApplication.java +++ b/src/main/java/com/ject/studytrip/StudytripApplication.java @@ -9,5 +9,4 @@ public class StudytripApplication { public static void main(String[] args) { SpringApplication.run(StudytripApplication.class, args); } - } diff --git a/src/main/resources/application-datasource.yml b/src/main/resources/application-datasource.yml index 56adcd7..a1ab59a 100644 --- a/src/main/resources/application-datasource.yml +++ b/src/main/resources/application-datasource.yml @@ -5,6 +5,6 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${DB_NAME:}?useSSL=false - username: ${MYSQL_USERNAME:} - password: ${MYSQL_PASSWORD:} \ No newline at end of file + url: jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:}?useSSL=false&allowPublicKeyRetrieval=true + username: ${DB_USERNAME:root} + password: ${DB_PASSWORD:} \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index e572e48..ab39ea0 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -2,3 +2,12 @@ spring: config: activate: on-profile: "dev" + + jpa: + hibernate: + ddl-auto: update + +logging: + level: + org.springframework.orm.jpa: DEBUG + org.springframework.transaction: DEBUG diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 4757dd6..f4679f7 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -3,3 +3,18 @@ spring: activate: on-profile: "local" + jpa: + hibernate: + ddl-auto: update + show-sql: true + properties: + hibernate: + format_sql: true + dialect: org.hibernate.dialect.MySQL8Dialect + defer-datasource-initialization: true + open-in-view: false + +logging: + level: + org.springframework.orm.jpa: DEBUG + org.springframework.transaction: DEBUG \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 622c895..940b53c 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -2,3 +2,7 @@ spring: config: activate: on-profile: "prod" + + jpa: + hibernate: + ddl-auto: none diff --git a/src/main/resources/application-security.yml b/src/main/resources/application-security.yml index ccab047..91cb1ff 100644 --- a/src/main/resources/application-security.yml +++ b/src/main/resources/application-security.yml @@ -2,3 +2,16 @@ spring: config: activate: on-profile: "security" + +jwt: + secret: ${JWT_SECRET:} + access-expiration-time: ${JWT_ACCESS_EXPIRATION_TIME:7200} + refresh-expiration-time: ${JWT_REFRESH_EXPIRATION_TIME:604800} + +oauth: + kakao: + client-id: ${KAKAO_CLIENT_ID:} + client-secret: ${KAKAO_CLIENT_SECRET:} + redirect-uri: ${KAKAO_REDIRECT_URI:} + token-uri: "https://kauth.kakao.com/oauth/token" + user-info-uri: "https://kapi.kakao.com/v2/user/me" \ No newline at end of file diff --git a/src/main/resources/application-storage.yml b/src/main/resources/application-storage.yml deleted file mode 100644 index 0182854..0000000 --- a/src/main/resources/application-storage.yml +++ /dev/null @@ -1,4 +0,0 @@ -spring: - config: - activate: - on-profile: "storage" diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a6b501b..47b06ae 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,8 +1,19 @@ spring: profiles: - active: ${SPRING_PROFILES_ACTIVE:local} include: - datasource - redis - - storage - security + +springdoc: + default-consumes-media-type: application/json;charset=UTF-8 + default-produces-media-type: application/json;charset=UTF-8 + swagger-ui: + path: /swagger-ui + disable-swagger-default-url: true + display-request-duration: true + tags-sorter: alpha + operations-sorter: alpha + syntax-highlight: + theme: none + urls-primary-name: StudyTrip API DOCS diff --git a/src/test/java/com/ject/studytrip/StudytripApplicationTests.java b/src/test/java/com/ject/studytrip/StudytripApplicationTests.java index 4e43e9a..4d574f5 100644 --- a/src/test/java/com/ject/studytrip/StudytripApplicationTests.java +++ b/src/test/java/com/ject/studytrip/StudytripApplicationTests.java @@ -1,13 +1,18 @@ package com.ject.studytrip; import org.junit.jupiter.api.Test; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +@ActiveProfiles("test") +@AutoConfigureTestDatabase( + replace = AutoConfigureTestDatabase.Replace.NONE) // 테스트 시 내장된 인메모리 DB를 사용하지 않는다는 설정 @SpringBootTest class StudytripApplicationTests { @Test void contextLoads() { + System.out.println("🌐 DB_HOST = " + System.getenv("DB_HOST")); } - } diff --git a/src/test/resources/application-test.yml b/src/test/resources/application-test.yml index c77a121..85d0292 100644 --- a/src/test/resources/application-test.yml +++ b/src/test/resources/application-test.yml @@ -2,3 +2,12 @@ spring: config: activate: on-profile: "test" + + jpa: + hibernate: + ddl-auto: update + show-sql: true + properties: + hibernate: + format_sql: true + dialect: org.hibernate.dialect.MySQL8Dialect