Skip to content

Commit

Permalink
Merge branch 'develop' into feat/issue-7
Browse files Browse the repository at this point in the history
  • Loading branch information
Go-Jaecheol authored Jan 20, 2024
2 parents 70e06ed + dff9ce5 commit f94d320
Show file tree
Hide file tree
Showing 64 changed files with 422 additions and 344 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/cicd-be.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Backend CI/CD

on:
push:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out Repository
uses: actions/checkout@v3
with:
token: ${{ secrets.ACTION_TOKEN }}
submodules: true

- name: Display first three lines of application.yml (debug)
run: head -n 3 src/main/resources/application.yml

- name: Set up JDK21
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '21'

- name: 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: Grant execute permission for gradlew
run: chmod +x gradlew

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

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: cicdsample
path: build/libs/*.jar

- name: Slack notification when build fail
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: [CI/CD] 백엔드 빌드 실패
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_COLOR: '#FF2D00'
SLACK_USERNAME: 'Github Action'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CICD }}

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: cicdsample

- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

- name: Add known hosts
run: |
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: SCP transfer
run: scp *.jar ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }}:~/deploy

- name: Execute remote shell script
run: |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "chmod +x ./deploy.sh"
ssh ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} "./deploy.sh"
- name: Slack notification when deploy fail
if: failure()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: [CI/CD] 백엔드 배포 실패
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_COLOR: '#FF2D00'
SLACK_USERNAME: 'Github Action'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CICD }}

- name: Slack notification when deploy success
if: success()
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: [CI/CD] 백엔드 배포 성공
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_COLOR: '#0019F4'
SLACK_USERNAME: 'Github Action'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_CICD }}
76 changes: 0 additions & 76 deletions .github/workflows/test-fe.yml

This file was deleted.

15 changes: 5 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
branches:
- main
- develop
paths:
- '.github/**'
- 'backend/**'

jobs:
test:
Expand All @@ -22,11 +19,11 @@ jobs:
- name: Repository 체크아웃
uses: actions/checkout@v3

- name: JDK 11 설정
- name: JDK 21 설정
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
java-version: 21
distribution: corretto

- name: Gradle 캐싱
uses: actions/cache@v3
Expand All @@ -39,11 +36,9 @@ jobs:
${{ runner.os }}-gradle-
- name: Gradle 권한 부여
working-directory: backend/
run: chmod +x ./gradlew
run: chmod +x gradlew

- name: 테스트 실행
working-directory: backend/
run: ./gradlew --info test

- name: 테스트 결과 PR에 코멘트 등록
Expand Down Expand Up @@ -72,5 +67,5 @@ jobs:
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_TITLE: Build Failure - ${{ github.event.pull_request.title }}
SLACK_MESSAGE: PR Url - ${{ github.event.pull_request.url }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PR_TEST }}
if: failure()
40 changes: 0 additions & 40 deletions build.gradle

This file was deleted.

48 changes: 48 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id ("org.springframework.boot") version "3.2.1"
id ("io.spring.dependency-management") version "1.1.4"
id ("java")
kotlin("jvm") version "1.9.20"
kotlin("plugin.spring") version "1.9.20"
kotlin("plugin.jpa") version "1.9.20"
}

group = "com.funeat"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_21

repositories {
mavenCentral()
}

dependencies {
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-web")
runtimeOnly("com.mysql:mysql-connector-j")
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("io.rest-assured:rest-assured:5.3.2")
testRuntimeOnly("com.h2database:h2")

implementation("org.springdoc:springdoc-openapi-ui:1.7.0")
implementation("com.github.maricn:logback-slack-appender:1.4.0")

implementation("org.springframework.boot:spring-boot-starter-actuator")
runtimeOnly("io.micrometer:micrometer-registry-prometheus")

implementation("com.amazonaws:aws-java-sdk-s3:1.12.547")

implementation("org.springframework.session:spring-session-jdbc")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "21"
}
}

tasks.withType<Test> {
useJUnitPlatform()
}
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
#validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "funeat"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.funeat.admin.application.AdminChecker;
import com.funeat.admin.domain.AdminAuthInfo;
import javax.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.funeat.product.domain.Product;
import java.util.List;
import java.util.Objects;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Path;
import jakarta.persistence.criteria.JoinType;
import jakarta.persistence.criteria.Path;
import org.springframework.data.jpa.domain.Specification;

public class AdminProductSpecification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import com.funeat.review.domain.Review;
import java.time.LocalDateTime;
import java.util.Objects;
import javax.persistence.criteria.JoinType;
import javax.persistence.criteria.Path;
import jakarta.persistence.criteria.JoinType;
import jakarta.persistence.criteria.Path;
import org.springframework.data.jpa.domain.Specification;

public class AdminReviewSpecification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import com.funeat.admin.domain.AdminAuthInfo;
import com.funeat.auth.exception.AuthException.NotLoggedInException;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/funeat/auth/application/AuthService.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import com.funeat.auth.dto.UserInfoDto;
import com.funeat.auth.util.PlatformUserProvider;
import com.funeat.member.application.MemberService;
import javax.servlet.http.Cookie;
import jakarta.servlet.http.Cookie;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Expand Down
Loading

0 comments on commit f94d320

Please sign in to comment.