diff --git "a/.github/ISSUE_TEMPLATE/-\342\232\231\357\270\217-fix.md" "b/.github/ISSUE_TEMPLATE/-\342\232\231\357\270\217-fix.md" new file mode 100644 index 0000000..8b74151 --- /dev/null +++ "b/.github/ISSUE_TEMPLATE/-\342\232\231\357\270\217-fix.md" @@ -0,0 +1,37 @@ +--- +name: "\b⚙️ FIX" +about: 버그 픽스 관련 +title: '' +labels: '' +assignees: '' + +--- + +### Issue 타입 +□ 기능 추가 +□ 기능 삭제 +□ 리팩터링 +□ 버그 리포트 +☑ 버그 수정 +□ 의존성, 환경 변수, 빌드 관련 코드 업데이트 + +*** + +### 📚 Description +#### 📋 어떤 버그였으며, 무엇이 원인이었나요? +> (이슈 번호를 같이 작성해주세요) +> 버그과 그 원인에 대해 간략하게 작성해주세요 + +#### ✅ 작업 상세 내용 +- [ ] TO DO + + +
+ +--- + +#### 🛠️ 작업 브랜치 +`` + +#### 👀 참고 자료 +- diff --git "a/.github/ISSUE_TEMPLATE/\360\237\222\241-feature.md" "b/.github/ISSUE_TEMPLATE/\360\237\222\241-feature.md" new file mode 100644 index 0000000..998b79b --- /dev/null +++ "b/.github/ISSUE_TEMPLATE/\360\237\222\241-feature.md" @@ -0,0 +1,36 @@ +--- +name: "\U0001F4A1 Feature" +about: 기능 개발 & 변경 +title: '' +labels: '' +assignees: '' + +--- + +### Issue 타입 +☑ 기능 추가 +□ 기능 삭제 +□ 리팩터링 +□ 버그 리포트 +□ 버그 수정 +□ 의존성, 환경 변수, 빌드 관련 코드 업데이트 + +*** + +### 📚 Description +#### 📋 어떤 기능인가요? +> 추가하려는 기능에 대해 간결하게 설명해주세요 + +#### ✅ 작업 상세 내용 +- [ ] TO DO + + +
+ +--- + +#### 🛠️ 작업 브랜치 +`` + +#### 👀 참고 자료 +- diff --git "a/.github/ISSUE_TEMPLATE/\360\237\233\240\357\270\217-refactor.md" "b/.github/ISSUE_TEMPLATE/\360\237\233\240\357\270\217-refactor.md" new file mode 100644 index 0000000..e19ebff --- /dev/null +++ "b/.github/ISSUE_TEMPLATE/\360\237\233\240\357\270\217-refactor.md" @@ -0,0 +1,36 @@ +--- +name: "\U0001F6E0️ Refactor" +about: 리팩터링 +title: '' +labels: '' +assignees: '' + +--- + +### Issue 타입 +□ 기능 추가 +□ 기능 삭제 +☑ 리팩터링 +□ 버그 리포트 +□ 버그 수정 +□ 의존성, 환경 변수, 빌드 관련 코드 업데이트 + +*** + +### 📚 Description +#### 📋 어떤 기능을 리팩터링 하나요? +> 리팩터링하려는 기능에 대해 간결하게 설명해주세요 + +#### ✅ 작업 상세 내용 +- [ ] TO DO + + +
+ +--- + +#### 🛠️ 작업 브랜치 +`` + +#### 👀 참고 자료 +- diff --git "a/.github/ISSUE_TEMPLATE/\360\237\247\250-bug-report.md" "b/.github/ISSUE_TEMPLATE/\360\237\247\250-bug-report.md" new file mode 100644 index 0000000..a8c5ab9 --- /dev/null +++ "b/.github/ISSUE_TEMPLATE/\360\237\247\250-bug-report.md" @@ -0,0 +1,29 @@ +--- +name: "\U0001F9E8 Bug Report" +about: 버그 리포트 +title: '' +labels: '' +assignees: '' + +--- + +### Issue 타입(하나 이상의 Issue 타입을 선택해주세요) +□ 기능 추가 +□ 기능 삭제 +□ 리팩터링 +☑ 버그 리포트 +□ 버그 수정 +□ 의존성, 환경 변수, 빌드 관련 코드 업데이트 + +### 📚 Description +#### 어떤 버그인가요? +> 어떤 버그인지 간결하게 설명해주세요 + +#### 어떤 상황에서 발생한 버그인가요? +> (가능하면) Given-When-Then 형식으로 서술해주세요 + +#### 예상 결과 +> 예상했던 정상적인 결과가 어떤 것이었는지 설명해주세요 + +#### 버그 (예상) 원인 +> 버그가 발생한 원인을 발견했거나, 예상되는 원인에 대해 설명해주세요 diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..eb6a514 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,34 @@ +### PR 타입 +☑ 기능 추가 +□ 기능 삭제 +□ 리팩터링 +□ 버그 리포트 +□ 버그 수정 +□ 의존성, 환경 변수, 빌드 관련 코드 업데이트 + +### 반영 브랜치 +ex) `feat/login` -> `dev` + +
+ +### 🛠️ 변경 사항 +ex) 로그인 시, 구글 소셜 로그인 기능을 추가했습니다. + +#### ✅ 작업 상세 내용 +- [ ] todo + +
+ +### 🧪 테스트 결과 +ex) 베이스 브랜치에 포함되기 위한 코드는 모두 정상적으로 동작해야 합니다. 결과물에 대한 스크린샷, GIF, 혹은 라이브 데모가 가능하도록 샘플API를 첨부할 수도 있습니다. + +
+ +### 📚 연관된 이슈 +ex) #이슈번호, #이슈번호 + +
+ +### 🤔 리뷰 요구사항(선택) +> 리뷰어가 특별히 봐주었으면 하는 부분이 있다면 작성해주세요 +> ex) 메서드 XXX의 이름을 더 잘 짓고 싶은데 혹시 좋은 명칭이 있을까요? diff --git a/.github/workflows/PRTest.yml b/.github/workflows/PRTest.yml new file mode 100644 index 0000000..2e155ca --- /dev/null +++ b/.github/workflows/PRTest.yml @@ -0,0 +1,69 @@ +name: Run gradlew clean test when PR + +on: + pull_request: + branches: [ "main", "production" ] + +jobs: + PRTest: + runs-on: ubuntu-latest + permissions: write-all + + services: + redis: + image: redis:latest + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.ACTIONS_TOKEN }} + submodules: true + + - name: Create directories and copy yml files + run: | + mkdir -p src/main/resources + cp HERE-WE-SECRET/main/resources/application.yml src/main/resources/ + cp HERE-WE-SECRET/main/resources/application-dev.yml src/main/resources/ + cp HERE-WE-SECRET/main/resources/application-oauth.yml src/main/resources/ + cp HERE-WE-SECRET/main/resources/application-common.yml src/main/resources/ + + mkdir -p src/test/resources + cp HERE-WE-SECRET/test/resources/application.yml src/test/resources/ + cp HERE-WE-SECRET/test/resources/application-test.yml src/test/resources/ + + echo "Main resources contents:" + ls -la src/main/resources/ + echo "Test resources contents:" + ls -la src/test/resources/ + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Test Redis Connection + run: | + sudo apt-get install -y redis-tools + redis-cli ping + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + shell: bash + + - name: Build and Test + run: ./gradlew clean test + + # Test 후 Report 생성 + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + junit_files: '**/build/test-results/test/TEST-*.xml' \ No newline at end of file diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..96e097d --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,119 @@ +name: Deploy to EC2 + +on: + push: + branches: + - production + +env: + AWS_REGION: ap-northeast-2 + AWS_S3_BUCKET: herewe-deploy-bucket + AWS_CODE_DEPLOY_APPLICATION: HEREWE-Application + AWS_CODE_DEPLOY_GROUP: HEREWE-Deployment-Group + DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} + DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }} + IMAGE_NAME: herewe/herewe-server + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + services: + redis: + image: redis:latest + ports: + - 6379:6379 + options: >- + --health-cmd "redis-cli ping" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.ACTIONS_TOKEN }} + submodules: true + + - name: Create directories and copy yml files + run: | + cp HERE-WE-SECRET/.env . + + mkdir -p src/main/resources + cp HERE-WE-SECRET/main/resources/application.yml src/main/resources/ + cp HERE-WE-SECRET/main/resources/application-prod.yml src/main/resources/ + cp HERE-WE-SECRET/main/resources/application-oauth.yml src/main/resources/ + cp HERE-WE-SECRET/main/resources/application-common.yml src/main/resources/ + + mkdir -p src/test/resources + cp HERE-WE-SECRET/test/resources/application.yml src/test/resources/ + cp HERE-WE-SECRET/test/resources/application-test.yml src/test/resources/ + + echo "Main resources contents:" + ls -la src/main/resources/ + echo "Test resources contents:" + ls -la src/test/resources/ + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + + - name: Test Redis Connection + run: | + sudo apt-get install -y redis-tools + redis-cli ping + + - name: Grant execute permission for gradlew + run: chmod +x ./gradlew + shell: bash + + - name: Build with Gradle and Test + run: ./gradlew clean build + + # Docker Hub 로그인 + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ env.DOCKER_HUB_USERNAME }} + password: ${{ env.DOCKER_HUB_ACCESS_TOKEN }} + + - name: Build and Push Docker Image + run: | + docker build --platform=linux/amd64 -t $IMAGE_NAME . + docker tag $IMAGE_NAME $IMAGE_NAME:latest + docker push $IMAGE_NAME:latest + + - name: AWS credential 설정 + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-region: ${{ env.AWS_REGION }} + aws-access-key-id: ${{ secrets.CICD_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.CICD_SECRET_KEY }} + + - name: Copy .env file + run: cp HERE-WE-SECRET/.env . + + - name: Package and Upload to S3 + run: | + mkdir -p deploy/scripts + cp appspec.yml deploy/ + cp docker-compose.yml deploy/ + cp HERE-WE-SECRET/.env deploy/ + cp HERE-WE-SECRET/main/resources/*.yml deploy/ + cp scripts/deploy.sh deploy/scripts/ + cd deploy + zip -r deploy.zip . + aws s3 cp deploy.zip s3://$AWS_S3_BUCKET/deploy.zip --region $AWS_REGION + + - name: Deploy with CodeDeploy + run: | + aws deploy create-deployment \ + --application-name $AWS_CODE_DEPLOY_APPLICATION \ + --deployment-group-name $AWS_CODE_DEPLOY_GROUP \ + --s3-location bucket=$AWS_S3_BUCKET,bundleType=zip,key=deploy.zip \ + --region $AWS_REGION diff --git a/.gitignore b/.gitignore index f03837f..ead98f1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ build/ !**/src/test/**/build/ *.yml +.env ### STS ### .apt_generated @@ -42,3 +43,5 @@ out/ ### MAC ### *.DS_Store src/main/generated/** +/.idea +/mysql_data \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0959721 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "HERE-WE-SECRET"] + path = HERE-WE-SECRET + url = https://github.com/TeamTheGenius/HERE-WE-SECRET.git diff --git a/.idea/compiler.xml b/.idea/compiler.xml index f94b4b7..f1062cc 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -5,8 +5,8 @@ - - + + diff --git a/.idea/gradle.xml b/.idea/gradle.xml index f9163b4..ce1c62c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ +