Skip to content

Commit

Permalink
[Merge] merge dev into main (#660)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimhan-nah authored Mar 1, 2024
2 parents 9ff3844 + da7fe73 commit aa0c298
Show file tree
Hide file tree
Showing 1,133 changed files with 38,376 additions and 30,752 deletions.
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# top-most EditorConfig file
root = true

[*]
# [encoding-utf8]
charset = utf-8

# [newline-lf]
end_of_line = lf

# [newline-eof]
insert_final_newline = true

[*.bat]
end_of_line = crlf

[*.java]
# [indentation-tab]
indent_style = tab

# [4-spaces-tab]
indent_size = 4
tab_width = 4

# [no-trailing-spaces]
trim_trailing_whitespace = true

[line-length-120]
max_line_length = 120
24 changes: 12 additions & 12 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
* text=auto eol=lf

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.java text=auto
*.sql text=auto
*.md text=auto
*.txt text=auto
*.gradle text=auto
Dockerfile text=auto
*.yml text=auto
*.yaml text=auto
*.sh text=auto

*.java text=auto eol=lf
*.sql text=auto eol=lf
*.md text=auto eol=lf
*.txt text=auto eol=lf
*.gradle text=auto eol=lf
Dockerfile text=auto eol=lf
*.yml text=auto eol=lf
*.yaml text=auto eol=lf
*.sh text=auto eol=lf
*.bat text=auto eol=crlf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpg binary
21 changes: 21 additions & 0 deletions .github/workflows/checkstyle-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 👮Checkstyle validation

on:
pull_request:
branches: [ main, dev ]

jobs:
checkstyle:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Main checkstyle
run: ./gradlew --console verbose clean checkstyleMain
- name: ️Test checkstyle
run: ./gradlew --console verbose clean checkstyleTest
4 changes: 2 additions & 2 deletions .github/workflows/main-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_NAME: wken5577/42gg-server
VERSION_TAG : ${{ secrets.VERSION_TAG }}
VERSION_TAG: ${{ secrets.VERSION_TAG }}

permissions:
contents: read
Expand All @@ -36,7 +36,7 @@ jobs:

- name: Make application ymls
run: |
cd ./src/main/resources
cd ./gg-pingpong-api/src/main/resources
echo "${{ secrets.APPLICATION_YML }}" | base64 -d > application.yml
shell: bash

Expand Down
26 changes: 16 additions & 10 deletions .github/workflows/test-code-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,35 @@ jobs:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: ️👶 Unit Test with Gradle
run: ./gradlew --console verbose clean unitTestCoverage
- name: mv for separate report folder
run: mv ./build/reports/jacoco/test ./build/reports/jacoco/unitTest
- name: mv for separate report name
run: mv ./build/reports/jacoco/unitTest/jacocoTestReport.xml ./build/reports/jacoco/unitTest/unitTestReport.xml
run: ./gradlew --console verbose clean unitTestCoverage unitTestCoverageReport -x test

# - name: mv for separate report folder
# run: mv ./gg-pingpong-utils/build/reports/jacoco/unitTestCoverageReport ./build/reports/jacoco/unitTest

# - name: mv for separate report name
# run: mv ./build/reports/jacoco/unitTest/jacocoTestReport.xml ./build/reports/jacoco/unitTest/unitTestReport.xml

- name: 📲 Upload unitTest coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/reports/jacoco/unitTest/unitTestReport.xml
files: ./gg-utils/build/reports/jacoco/unitTestCoverageReport/unitTestCoverageReport.xml
flags: unitTest
name: codecov-unit
verbose: true

- name: 👨‍👨‍👧‍👦 Integration Test with Gradle
run: ./gradlew --console verbose clean integrationTestCoverage
run: ./gradlew --console verbose clean integrationTestCoverage integrationTestCoverageReport -x test

- name: 📲 Upload integrationTest coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
files: ./build/reports/jacoco/test/jacocoTestReport.xml
files: ./gg-utils/build/reports/jacoco/integrationTestCoverageReport/integrationTestCoverageReport.xml
flags: integrationTest
name: codecov-integration
verbose: true
115 changes: 59 additions & 56 deletions .github/workflows/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
IMAGE_NAME: wken5577/test-migrate-server

permissions:
contents: read

Expand All @@ -26,63 +26,66 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Make application ymls
run: |
cd ./src/main/resources
echo "${{ secrets.MIGRATE_APPLICATION_YML }}" | base64 -d > application.yml
shell: bash
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
- name: Checkout
uses: actions/checkout@v3

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

- name: Make application ymls
run: |
cd ./gg-pingpong-api/src/main/resources
echo "${{ secrets.MIGRATE_APPLICATION_YML }}" | base64 -d > application.yml
shell: bash

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKER_USER }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Build with Gradle
run: ./gradlew clean test build

- name: build new docker image as latest tag
run: |
docker build -t ${{ env.IMAGE_NAME }}:latest .
docker push ${{ env.IMAGE_NAME }}:latest
- name: Get Github Actions IP
id: ip
uses: haythem/public-ip@v1.3

- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_TEST_MIGRATE_SECURITY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_MIGRATE_SECURITY_SECRET_KEY }}
aws-region: ap-northeast-2

- name: Add Github Actions IP to Security group
run: |

- name: Test with Gradle
run: ./gradlew clean test

- name: Build with Gradle
run: ./gradlew clean build -x test

- name: build new docker image as latest tag
run: |
docker build -t ${{ env.IMAGE_NAME }}:latest .
docker push ${{ env.IMAGE_NAME }}:latest
- name: Get Github Actions IP
id: ip
uses: haythem/public-ip@v1.3

- name: AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_TEST_MIGRATE_SECURITY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TEST_MIGRATE_SECURITY_SECRET_KEY }}
aws-region: ap-northeast-2

- name: Add Github Actions IP to Security group
run: |
aws ec2 authorize-security-group-ingress --group-id ${{ secrets.AWS_TEST_MIGRATE_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32
- name: executing docker-compose up on test server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TEST_MIGRATE_SERVER_HOST }}
username: ${{ secrets.TEST_MIGRATE_SERVER_USERNAME }}
key: ${{ secrets.TEST_MIGRATE_SERVER_PEM }}
script: |
cd /home/ec2-user/docker
docker-compose down tomcat
docker rmi ${{ env.IMAGE_NAME }}:latest
docker-compose up tomcat -d
docker-compose up prometheus -d
- name: Remove Github Actions IP From Security Group
run: |
- name: executing docker-compose up on test server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TEST_MIGRATE_SERVER_HOST }}
username: ${{ secrets.TEST_MIGRATE_SERVER_USERNAME }}
key: ${{ secrets.TEST_MIGRATE_SERVER_PEM }}
script: |
cd /home/ec2-user/docker
docker-compose down tomcat
docker rmi ${{ env.IMAGE_NAME }}:latest
docker-compose up tomcat -d
docker-compose up prometheus -d
- name: Remove Github Actions IP From Security Group
run: |
aws ec2 revoke-security-group-ingress --group-id ${{ secrets.AWS_TEST_MIGRATE_SG_ID }} --protocol tcp --port 22 --cidr ${{ steps.ip.outputs.ipv4 }}/32
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,8 @@ build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
src/main/resources/application.yml
src/main/resources/application-local.yml
src/main/resources/application-main.yml
src/main/resources/application-test.yml
gg-pingpong-api/src/main/resources/application.yml
.DS_Store
src/test/resources/application.yml
src/test/resources/application-local.yml
python
/logs

Expand Down Expand Up @@ -54,4 +49,4 @@ pingping.pem
./logs/*

### git commit message convention file ###
.gitmessage.txt
.gitmessage.txt
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ FROM openjdk:11-jdk

WORKDIR /app

ARG JAR_FILE=build/libs/server-42gg.jar
ARG JAR_FILE=gg-pingpong-api/build/libs/gg-pingpong-api-42gg.jar

COPY ${JAR_FILE} .

EXPOSE 8080
ENTRYPOINT ["java","-jar","server-42gg.jar", \
ENTRYPOINT ["java","-jar","gg-pingpong-api-42gg.jar", \
"--spring.profiles.active=${PROFILE}", \
"--spring.security.oauth2.client.registration.42.client-id=${SPRING_42_CLIENT_ID}", \
"--spring.security.oauth2.client.registration.42.client-secret=${SPRING_42_CLIENT_SECRET}"]
Loading

0 comments on commit aa0c298

Please sign in to comment.