-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* ci: CD 스크립트 추가 * chore: JaCoCo 설정 추가 * chore: SonarCloud 설정 추가 * ci: CI 스크립트 추가 * ci: jacocoTestCoverage를 수행하도록 수정 * ci: SonarCloud 설정 추가 * ci: 서브모듈 설정 추가 * ci: 테스트를 위해 sonarcloud 설정 제거 * ci: 테스트를 위한 리소스 파일 추가 * ci: SonarCloud 설정 추가
- Loading branch information
Showing
6 changed files
with
263 additions
and
1 deletion.
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,48 @@ | ||
name: CI - JaCoCo & SonarCloud | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: checkout branch | ||
uses: actions/checkout@v3 | ||
|
||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: cache SonarCloud packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.sonar/cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
|
||
- name: cache gradle | ||
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: chmod gradle | ||
run: chmod +x ./ | ||
|
||
- name: build and analyze | ||
run: | | ||
./gradlew build jacocoTestCoverage sonar | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
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,68 @@ | ||
name: Dev Server CD | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: checkout branch | ||
uses: actions/checkout@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
submodules: true | ||
|
||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: cache gradle | ||
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: chmod gradle | ||
run: chmod +x ./ | ||
|
||
- name: build application | ||
run: ./gradlew bootJar | ||
|
||
- name: scp to dev server | ||
uses: appleboy/scp-action@master | ||
with: | ||
username: ubuntu | ||
host: ${{ secrets.DEV_PUBLIC_IP }} | ||
key: ${{ secrets.DEV_PRIVATE_KEY }} | ||
source: "./build/libs/*.jar" | ||
target: "/home/ubuntu" | ||
strip_components: 2 | ||
|
||
- name: deploy application | ||
uses: appleboy/ssh-action@master | ||
with: | ||
username: ubuntu | ||
host: ${{ secrets.DEV_PUBLIC_IP }} | ||
key: ${{ secrets.DEV_PRIVATE_KEY }} | ||
script: | | ||
sudo /home/ubuntu/deploy.sh | ||
- name: send result to slack | ||
if: always() | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: ${{ job.status }} | ||
author_name: Github Action CD | ||
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lombok.addLombokGeneratedAnnotation = true |
33 changes: 33 additions & 0 deletions
33
src/test/java/com/backend/blooming/user/domain/UserTest.java
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,33 @@ | ||
package com.backend.blooming.user.domain; | ||
|
||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.api.DisplayNameGenerator; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.SoftAssertions.assertSoftly; | ||
|
||
@DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class) | ||
@SuppressWarnings("NonAsciiCharacters") | ||
class UserTest { | ||
|
||
@Test | ||
void 사용자를_생성한다() { | ||
// when | ||
final User actual = User.builder() | ||
.oauthId("12345") | ||
.email("[email protected]") | ||
.name("사용자") | ||
.color("#12345") | ||
.statusMessage("상태 메시지") | ||
.build(); | ||
|
||
// then | ||
assertSoftly(softAssertions -> { | ||
softAssertions.assertThat(actual.getOauthId()).isEqualTo("12345"); | ||
softAssertions.assertThat(actual.getEmail()).isEqualTo("[email protected]"); | ||
softAssertions.assertThat(actual.getName()).isEqualTo("사용자"); | ||
softAssertions.assertThat(actual.getColor()).isEqualTo("#12345"); | ||
softAssertions.assertThat(actual.getStatusMessage()).isEqualTo("상태 메시지"); | ||
}); | ||
} | ||
} |
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,27 @@ | ||
spring: | ||
datasource: | ||
url: jdbc:h2:mem:testdb | ||
username: sa | ||
driver-class-name: org.h2.Driver | ||
|
||
jpa: | ||
hibernate: | ||
ddl-auto: create-drop | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
dialect: org.hibernate.dialect.H2Dialect | ||
show_sql: true | ||
use_sql_comments: true | ||
open-in-view: false | ||
|
||
oauth: | ||
client: | ||
kakao: | ||
user-info-uri: https://kapi.kakao.com/v2/user/me | ||
|
||
jwt: | ||
access-token-key: testtesttesttesttesttesttesttesttesttestesttesttesttesttest | ||
refresh-token-key: testtesttesttesttesttesttesttesttesttestesttesttesttesttest | ||
access-token-expire-hour: 12 | ||
refresh-token-expire-hour: 1440 |