-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [Weekly/10/Test/Member-Service] 멤버 도메인 서비스 유닛테스트 (#70) * test: 멤버 도메인 application 패키지 테스트 추가 * refactor: early return 리팩터링 * [Weekly/10/All/fetchJoin] 연관관계 설정 수정, 페치 조인, 배치사이즈 설정, 페이지네이션 (#71) * feature: reservation 페치조인, 페이징 * feat: ad 페치조인, 페이징 * feat: curation 페치조인, 페이징 * feat: event 페치조인, 페이징 * refactor: todo 추가 * fix: JPQL 수정 * fix: oneToMany관계 page 사용시 fetch join 수정 * feat: 정렬기준 createdDate가 아닌 ID 로 수정 * [Weekly/10/All/Set-Authorization] authorization 로직 추가 (#72) * [Weekly/10/Feature/Authorization] 모든 컨트롤러 authorization 적용 및 서비스 검증 로직 추가 (#73) * [Weekly/10/Deploy/CICD] CI/CD 관련 스크립트 추가 (#74) * [Weekly/10/Test/Event] Event 테스트(1차) 및 TestData 리펙터링 (#77) * [Weekly/10/Chore/Deploy] CI/CD 스크립트 그룹화 (#78) * chore: github action jobs 그룹화 * chore: Dockerfile 못찾는 문제 수정 * chore: docker build 오류 수정 * chore: docker build 오류 수정 2 * chore: docker build 오류 수정 3 * [Weekly/10/Test/Authorization] 큐레이션 유닛 테스트 (#79) * [Weekly/10/Test/Event] Event 단위테스트 (#80) * [Weekly/10/Chore/Deploy] PR시 secrets에 접근 가능하도록 수정 (#81) * refactor: Like Controller return값 리팩터링 (#82) * [Weekly/10/Chore/Deploy] push일 때만 Deploy되도록 수정 (#83) * chore: push일 때만 Deploy되도록 수정 * chore: push일 때만 Docker push 되도록 수정 * [Weekly/10/Test/Member-Controllers] add MemberControllerUnitTest Template (#84) * feat: 큐레이션 컨트롤러 유닛테스트 (#85) * [Weekly/10/Test/Refactor-MemberId] test 관련 member 도메인의 아이디 상수화 이외 1개 (#86) * refactor: test 관련 memberId 상수화 * chore: 이제는 github action시 테스트도 수행함 * [Weekly/10/Chore/Deploy] Github Action 스크립트 수정 (#89) * fix: attempt 1 * fix: attempt 2 (log show) * fix: attempt 3 (add secrets.env) * feat: .env 업데이트 기능 추가 * feat: jobs 단계 세분화 * fix: test fail fix attempt 1 * fix: docker build fail fix attempt 2 * chore: add echo * chore: rename jobs step naming * [Weekly/10/Test/CurationController] curationControllerUnitTest (#88) * [Weekly/10/Reservation/unitTest] Reservation unit 테스트 추가 * feat: reservation unit test * feat: 행사명으로 검색 로직 추가 * feat: url을 이미지로 저장하는 로직 --------- Co-authored-by: 조홍식 <[email protected]> Co-authored-by: ariimo <[email protected]>
- Loading branch information
1 parent
2342924
commit 2edb5d8
Showing
104 changed files
with
3,463 additions
and
776 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
name: CI/CD Github Action | ||
|
||
on: | ||
push: | ||
branches: [ "Master", "Weekly/*" ] | ||
pull_request_target: | ||
branches: [ "Master", "Weekly/*" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
GOOGLE_CLIENT_ID : ${{ secrets.ENV_GOOGLE_CLIENT_ID }} | ||
GOOGLE_CLIENT_SECRET: ${{ secrets.ENV_GOOGLE_CLIENT_SECRET }} | ||
GOOGLE_REDIRECT_URI : ${{ secrets.ENV_GOOGLE_REDIRECT_URI }} | ||
JWT_SECRET : ${{ secrets.ENV_JWT_SECRET }} | ||
KAKAO_CLIENT_ID : ${{ secrets.ENV_KAKAO_CLIENT_ID }} | ||
KAKAO_CLIENT_SECRET : ${{ secrets.ENV_KAKAO_CLIENT_SECRET }} | ||
KAKAO_REDIRECT_URI : ${{ secrets.ENV_KAKAO_REDIRECT_URI }} | ||
KAKAOPAY_SECRET_KEY : ${{ secrets.ENV_KAKAOPAY_SECRET_KEY }} | ||
|
||
jobs: | ||
## 1단계: 프로젝트 빌드 | ||
Build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'corretto' | ||
|
||
- name: Gradle Caching (for faster build) | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Build Application | ||
run: | | ||
chmod +x gradlew | ||
./gradlew clean build -x test | ||
- name: Store build failure reports (execute when build fail) | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-failure-reports | ||
path: | | ||
**/build/reports/ | ||
- name: Store build artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: build/libs/*.jar | ||
|
||
## 2단계: 테스트 실행 | ||
Test: | ||
runs-on: ubuntu-22.04 | ||
needs: Build # Build 단계가 완료되어야 실행됨 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '21' | ||
distribution: 'corretto' | ||
|
||
- name: Gradle Caching (for faster build) | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Test Application | ||
run: | | ||
chmod +x gradlew | ||
./gradlew test | ||
- name: Store test failure reports (execute when test fail) | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: test-failure-reports | ||
path: | | ||
**/build/test-results/ | ||
## 3단계: Docker 빌드 및 푸시 | ||
Docker-Build: | ||
runs-on: ubuntu-22.04 | ||
needs: Test # Test 단계가 성공적으로 완료되어야 실행됨 | ||
if: github.event_name == 'push' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download Build Artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: build-artifacts | ||
path: build/libs | ||
|
||
- name: Docker Hub Login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Docker Build | ||
run: docker build -f Dockerfile --build-arg DEPENDENCY=build/dependency -t ${{ secrets.DOCKER_REPO_FULLNAME }} . | ||
|
||
- name: Docker Push | ||
run: docker push ${{ secrets.DOCKER_REPO_FULLNAME }} | ||
|
||
## 4단계: 서버에 배포 | ||
Deploy: | ||
runs-on: ubuntu-22.04 | ||
needs: Docker-Build | ||
if: github.event_name == 'push' | ||
steps: | ||
- name: Update .env | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
script: | | ||
echo "GOOGLE_CLIENT_ID=${{ secrets.ENV_GOOGLE_CLIENT_ID }}" > ~/.env | ||
echo "GOOGLE_CLIENT_SECRET=${{ secrets.ENV_GOOGLE_CLIENT_SECRET }}" >> ~/.env | ||
echo "GOOGLE_REDIRECT_URI=${{ secrets.ENV_GOOGLE_REDIRECT_URI }}" >> ~/.env | ||
echo "JWT_SECRET=${{ secrets.ENV_JWT_SECRET }}" >> ~/.env | ||
echo "KAKAO_CLIENT_ID=${{ secrets.ENV_KAKAO_CLIENT_ID }}" >> ~/.env | ||
echo "KAKAO_CLIENT_SECRET=${{ secrets.ENV_KAKAO_CLIENT_SECRET }}" >> ~/.env | ||
echo "KAKAO_REDIRECT_URI=${{ secrets.ENV_KAKAO_REDIRECT_URI }}" >> ~/.env | ||
echo "KAKAOPAY_SECRET_KEY=${{ secrets.ENV_KAKAOPAY_SECRET_KEY }}" >> ~/.env | ||
echo "Environment setup has been completed." | ||
- name: Pull New Docker Image | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
envs: GITHUB_SHA | ||
script: sudo docker pull ${{ secrets.DOCKER_REPO_FULLNAME }} | ||
|
||
- name: Stop Old Docker Image | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
envs: GITHUB_SHA | ||
script: sudo docker stop would-you-in | ||
|
||
- name: Run New Docker Image | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
envs: GITHUB_SHA | ||
script: sudo docker run --rm -d -p 80:8080 --env-file ~/.env --name would-you-in ${{ secrets.DOCKER_REPO_FULLNAME }} | ||
|
||
- name: Clean-Up Docker Image | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.SSH_HOST }} | ||
username: ${{ secrets.SSH_USERNAME }} | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
port: ${{ secrets.SSH_PORT }} | ||
envs: GITHUB_SHA | ||
script: sudo docker image prune -f |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,3 +38,6 @@ out/ | |
|
||
### static images | ||
/src/main/resources/staticimages/ | ||
|
||
### env file | ||
.env |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# open jdk 21 버전의 환경을 구성한다. | ||
FROM openjdk:21-jdk-slim | ||
|
||
# build가 될 때 JAR_FILE이라는 변수 명에 build/libs/*.jar 선언 | ||
# build/libs - gradle로 빌드했을 때 jar 파일이 생성되는 경로임 | ||
ARG JAR_FILE=build/libs/*.jar | ||
|
||
# JAR_FILE을 agaproject.jar로 복사 (이 부분(.jar)은 개발환경에 따라 다름) | ||
COPY ${JAR_FILE} wouldyouin.jar | ||
|
||
# 운영 및 개발에서 사용되는 환경 설정을 분리한다. | ||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=deploy", "/wouldyouin.jar"] |
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
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
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
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
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
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
Oops, something went wrong.