Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#λΉŒλ“œ μΊμ‹œ
.gradle
build
!build/libs/*.jar
out
target

#IDE μ„€μ •
*.iml
.idea
.vscode

#OS μž„μ‹œ 파일
.DS_Store
Thumbs.db

#Git κ΄€λ ¨
.git
.gitignore

# 둜그, ν™˜κ²½λ³€μˆ˜
*.log
.env
*.secret
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/♻️-refactor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: "♻️ refactor"
about: λ¦¬νŒ©ν† λ§ 이슈 ν…œν”Œλ¦Ώ
titles: "♻️ "
labels: "♻️ refactor"
assignees: ''

---

## πŸ“Œ Description

11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/βš™οΈ-chore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: "βš™οΈ chore"
about: CI/CD 및 μ„€μ • 이슈 ν…œν”Œλ¦Ώ
titles: "βš™οΈ "
labels: "βš™οΈ chore"
assignees: ''

---

## πŸ“Œ Description

11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/✨-feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: "✨ feature"
about: κΈ°λŠ₯ μΆ”κ°€ 이슈 ν…œν”Œλ¦Ώ
titles: "✨ "
labels: "✨ feature"
assignees: ''

---

## πŸ“Œ Description

12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/πŸ›-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: "πŸ› fix"
about: 버그 및 μ—λŸ¬ 이슈 ν…œν”Œλ¦Ώ
titles: "πŸ› "
labels: "πŸ› bug/error"
assignees: ''

---

## πŸ“Œ Description


13 changes: 13 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## πŸ”· Jira Ticket ID

[KW-]

---
## πŸ“Œ μž‘μ—… λ‚΄μš© 및 νŠΉμ΄μ‚¬ν•­

-

---
## πŸ“š 참고사항

-
41 changes: 41 additions & 0 deletions .github/workflows/develop_ci_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Push on PR Target

on:
push:
branches:
- develop

jobs:
docker-build-and-push:
runs-on: ubuntu-latest

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

- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21

- run: chmod +x ./gradlew

- name: Run tests
run: ./gradlew test

- name: Build JAR
run: ./gradlew build

- name: Docker login
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: sunwoo11/admin-service:latest
46 changes: 46 additions & 0 deletions .github/workflows/develop_ci_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Develop PR CI & Test
on:
pull_request:
branches:
- develop

permissions:
contents: read
packages: write

env:
DOCKER_IMAGE_NAME: sunwoo11/admin-service
DOCKER_TAG: latest

jobs:
build-test:
if: github.event_name == 'pull_request' && github.base_ref == 'develop'
runs-on: ubuntu-latest

steps:
- name: Checkout source code
uses: actions/checkout@v3

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

- name: Cache Gradle packages
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: Run Spotless check
run: ./gradlew spotlessCheck

- name: Run tests
run: ./gradlew test
46 changes: 46 additions & 0 deletions .github/workflows/pr_title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Auto PR Title Prefix

on:
pull_request:
types: [opened, edited]

permissions:
pull-requests: write

jobs:
update-title:
runs-on: ubuntu-latest
steps:
- name: Extract issue key and update PR title
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const pr = context.payload.pull_request;
const branchName = pr.head.ref;

const match = branchName.match(/(KW-\d+)/);
if (!match) {
console.log("No KW-XX issue key found in branch name.");
return;
}

const issueKey = match[1];

const cleanTitle = pr.title
.replace(/^\[KW-\d+\]\s*/, '')
.replace(new RegExp(`^${issueKey}/`), '')

const newTitle = `[${issueKey}] ${cleanTitle}`;

if (newTitle !== pr.title) {
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
title: newTitle
});
console.log("PR title updated to:", newTitle);
} else {
console.log("PR title already formatted correctly.");
}
43 changes: 43 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### .DS_Store ###
.DS_Store

### .env ###
.env
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM eclipse-temurin:21-jdk-alpine

RUN apk update && apk upgrade --no-cache
RUN apk add curl

ARG JAR_FILE=build/libs/*.jar
COPY ${JAR_FILE} app.jar

ENTRYPOINT ["java", "-jar", "/app.jar"]
106 changes: 106 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.4'
id 'io.spring.dependency-management' version '1.1.7'
id 'com.diffplug.spotless' version '6.25.0'
}

group = 'com.doubleo'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

ext {
set('springCloudVersion', "2024.0.1")
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
//config
implementation 'org.springframework.cloud:spring-cloud-starter-config'
implementation 'org.springframework.cloud:spring-cloud-starter-bus-amqp'
//eureka
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
//openfeign
implementation 'org.springframework.cloud:spring-cloud-starter-openfeign'

//Swagger
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.0'

compileOnly 'org.projectlombok:lombok'
//mysql
implementation 'mysql:mysql-connector-java:8.0.33'

//actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-core'
implementation 'io.micrometer:micrometer-registry-prometheus'

annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'com.h2database:h2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}

dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}


tasks.named('test') {
useJUnitPlatform()
}

spotless {
java {
// Google Java 포맷 적용
/*
googleJavaFormat() : 탭은 2개의 곡백
googleJavaFormat().aosp() : 탭은 4개의 곡백
[μ°Έκ³ ] https://github.com/google/google-java-format/issues/525
*/
googleJavaFormat().aosp()
// import μˆœμ„œ μ •λ ¬
importOrder()
// μ‚¬μš©ν•˜μ§€ μ•ŠλŠ” import 제거
removeUnusedImports()
// 각 라인 끝에 μžˆλŠ” 곡백을 제거
trimTrailingWhitespace()
// 파일 끝에 μƒˆλ‘œμš΄ 라인 μΆ”κ°€
endWithNewline()
}
}

tasks.register('updateGitHooks', Copy) {
from('./scripts/') {
include 'pre-commit'
include 'prepare-commit-msg'
}
into './.git/hooks'
}


tasks.register('makeGitHooksExecutable', Exec) {
commandLine 'chmod', '+x', './.git/hooks/pre-commit', './.git/hooks/prepare-commit-msg'
dependsOn updateGitHooks
}

compileJava.dependsOn makeGitHooksExecutable

Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading