Skip to content

Commit

Permalink
Merge pull request #225 from Myongji-Graduate/develop
Browse files Browse the repository at this point in the history
졸업을 부탁해 v2
  • Loading branch information
stophwan authored Dec 17, 2023
2 parents 0c29a8a + f58c3d3 commit a5b85cd
Show file tree
Hide file tree
Showing 439 changed files with 15,375 additions and 6,297 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @dojinyou @stophwan @5uhwann
* @stophwan @5uhwann @Hoya324
7 changes: 2 additions & 5 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## Issue

## ✅ 작업 내용
- 리뷰어가 중점적으로 봐야하는 부분을 바로 알 수 있도록 변경된 내용을 나열합니다.

Expand All @@ -10,8 +12,3 @@
- 도움이 필요한 부분이 없다면 **삭제** 해도 됩니다.
- **팀원들의 의견이 꼭 필요한 부분**을 작성해주세요.
- **팀원들은 놓치지 않고 꼭 이 항목을 보고 의견을 주세요.**

## 🔗 링크 (Links)
- [이슈](#)
- [API 스펙 문서](#)
- [기획 문서](#)
83 changes: 39 additions & 44 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,60 @@
name: Deploy
name: Dev

on:
push:
branches:
- release

env:
S3_BUCKET_NAME: gitaction-s3-bucket
RESOURCE_PATH: ./src/main/resources/application.yml
CODE_DEPLOY_APPLICATION_NAME: pg-webservice-codeploy
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: pg-webservice-codedeploy-prod-group
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
java-version: '11'

- name: Set yaml file
uses: microsoft/variable-substitution@v1
- name: Gradle Caching
uses: actions/cache@v3
with:
files: ${{ env.RESOURCE_PATH }}
env:
spring.datasource.url: ${{secrets.DB_URL}}
spring.datasource.username: ${{secrets.DB_USERNAME}}
spring.datasource.password: ${{secrets.DB_PASSWORD}}
server.port: ${{secrets.PORT}}
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash

- name: Build with Gradle
run: ./gradlew build
shell: bash

- name: Make zip file
run: zip -r ./$GITHUB_SHA.zip .
shell: bash
run: chmod +x gradlew

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Upload to S3
run: aws s3 cp --region ap-northeast-2 ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$GITHUB_SHA.zip
- name: Build with gradle
run : ./gradlew build -x test -x asciidoctor

- name: Code Deploy
- name: Build Docker image
run: |
aws deploy create-deployment \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$GITHUB_SHA.zip
docker login -u ${{ secrets.DOCKERHUB_ID }} -p ${{ secrets.DOCKERHUB_PASSWORD }}
docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2 \
--build-arg DATASOURCE_URL=${{ secrets.DATASOURCE_URL }} \
--build-arg DATASOURCE_USERNAME=${{ secrets.DATASOURCE_USERNAME }} \
--build-arg DATASOURCE_PASSWORD=${{ secrets.DATASOURCE_PASSWORD }} \
--build-arg JWT_SECRET=${{ secrets.JWT_SECRET }} .
docker push ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2
- name: Docker Deploy executing remote ssh commands using ssh_key
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.WAS_HOST }}
username: ${{ secrets.WAS_USERNAME }}
key: ${{ secrets.WAS_KEY }}
script : |
cd ~/mju-graduate-server
docker stop $(docker ps -a -q)
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2
docker rm -f $(docker ps -a -q)
docker run -d --name mju-graduate-server -p 8080:8080 ${{ secrets.DOCKERHUB_USERNAME }}/mju-graduate-server:v2
docker image prune -f
22 changes: 11 additions & 11 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Test & Jacoco Code Coverage

on:
push:
branches: [ main ]
branches: [ main, develop ]
pull_request:
branches: [ main ] # master branch에 PR을 보낼 때 실행
branches: [ main, develop ]

jobs:
test:
Expand All @@ -19,15 +19,15 @@ jobs:
java-version: '11'
distribution: 'temurin'

- name: Set yaml file
uses: microsoft/variable-substitution@v1
- name: Gradle Caching
uses: actions/cache@v3
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{secrets.DB_URL}}
spring.datasource.username: ${{secrets.DB_USERNAME}}
spring.datasource.password: ${{secrets.DB_PASSWORD}}
server.port: ${{secrets.PORT}}
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Gradle wrapper 파일 실행 권한주기
- name: Grant execute permission for gradlew
Expand All @@ -38,5 +38,5 @@ jobs:
run: ./gradlew build jacocoTestReport

# report 업로드하기
- name: Upload coverage to Codecv
- name: Upload coverage to Codecov
uses: codecov/[email protected]
37 changes: 16 additions & 21 deletions .github/workflows/sonarqube.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,42 @@
name: SonarQube
on:
push:
branches: [ main ]
branches: [ main, develop ]
pull_request:
branches: [ main ]
branches: [ main, develop ]

jobs:
build:
name: SonarQube
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11

- name: Set yaml file
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{secrets.DB_URL}}
spring.datasource.username: ${{secrets.DB_USERNAME}}
spring.datasource.password: ${{secrets.DB_PASSWORD}}
server.port: ${{secrets.PORT}}

- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v1
- name: Gradle Caching
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
# Gradle wrapper 파일 실행 권한주기
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea
*.iws
Expand All @@ -13,6 +12,8 @@ out/
!**/src/main/**/out/
!**/src/test/**/out/


/node_modules
*.DS_Store
*.DS_Store

deploy/
src/main/java/com/plzgraduate/myongjigraduatebe/core/EnvironmentCheck.java
5 changes: 0 additions & 5 deletions .husky/prepare-commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,3 @@ if !(printf '%s\n' "${TYPE_LIST[@]}" | grep -xq $TYPE); then
printf '%s\n' "${TYPE_LIST[@]}"
exit 1
fi

# if [ -n $ISSUE_NUMBER ] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
if [ -n $ISSUE_NUMBER ] && ! [[ $BRANCH_IN_COMMIT -ge 1 ]]; then
sed -i.bak -e "1s/^/[$ISSUE_NUMBER]/" $1
fi
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM openjdk:11

ARG JAR_FILE=build/libs/*.jar
ARG PROFILE=prod
ARG DATASOURCE_URL
ARG DATASOURCE_USERNAME
ARG DATASOURCE_PASSWORD
ARG JWT_SECRET

COPY ${JAR_FILE} app.jar

ENV PROFILE=${PROFILE}
ENV DATASOURCE_URL=${DATASOURCE_URL}
ENV DATASOURCE_USERNAME=${DATASOURCE_USERNAME}
ENV DATASOURCE_PASSWORD=${DATASOURCE_PASSWORD}
ENV JWT_SECRET=${JWT_SECRET}

EXPOSE 8080

ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=${PROFILE}", "/app.jar"]
19 changes: 0 additions & 19 deletions appspec.yml

This file was deleted.

Loading

0 comments on commit a5b85cd

Please sign in to comment.