Skip to content

Commit

Permalink
v1.0.0 (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdomo authored Jan 28, 2024
2 parents 0604b89 + f721008 commit 5de8f6d
Show file tree
Hide file tree
Showing 159 changed files with 6,697 additions and 18 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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@kdomo @uwoobeat @uiurihappy
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: 리팩토링 이슈 템플릿
title: "♻️ "
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 이슈 템플릿
title: "⚙️ "
labels: "⚙️ chore"
assignees: ''

---

## 📌 Description
-
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/✅-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: "✅ test"
about: 테스트 이슈 템플릿
title: ""
labels: "✅ test"
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: 기능 추가 이슈 템플릿
title: ""
labels: "✨ feature"
assignees: ''

---

## 📌 Description
-
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/🐛-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: "🐛 fix"
about: 버그 및 에러 이슈 템플릿
title: "🐛 "
labels: "🐛 bug/error"
assignees: ''

---

## 📌 Description
-
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/📝-documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: "📝 documentation"
about: 문서화 이슈 템플릿
title: "📝 "
labels: "📝 documentation"
assignees: ''

---

## 📌 Description
-
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## 🌱 관련 이슈
- close #

## 📌 작업 내용 및 특이사항
-

## 📝 참고사항
-

## 📚 기타
-
111 changes: 111 additions & 0 deletions .github/workflows/develop_build_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: develop Build And Deploy

on:
push:
branches: [ "develop" ]

jobs:
build:
runs-on: ubuntu-latest
environment: DEV
strategy:
matrix:
java-version: [ 17 ]
distribution: [ 'temurin' ]
outputs:
# IMAGE_TAG 환경 변수를 다른 Job에서 사용하기 위해 설정
image-tag: ${{ steps.image-tag.outputs.value }}
steps:
# 기본 체크아웃
- name: Checkout
uses: actions/checkout@v3

# JDK를 17 버전으로 세팅
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: ${{ matrix.distribution }}

# 이미지 태그 설정
- name: Set up image-tag by GITHUB_SHA
id: image-tag
run: echo "value=$(echo ${GITHUB_SHA::7})" >> $GITHUB_OUTPUT

# test 돌릴때 레디스 필요
- name: Start containers
run: docker-compose -f ./docker-compose-test.yaml up -d

# Gradlew 실행 허용
- name: Run chmod to make gradlew executable
run: chmod +x ./gradlew

# Gradle 빌드
- name: Build with Gradle
id: gradle
uses: gradle/gradle-build-action@v2
with:
arguments: |
build
--scan
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

# NCP Container Registry 로그인
- name: Login to NCP Container Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.NCP_CONTAINER_REGISTRY }}
username: ${{ secrets.NCP_ACCESS_KEY }}
password: ${{ secrets.NCP_SECRET_KEY }}

# Docker 이미지 빌드 및 푸시
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ secrets.NCP_CONTAINER_REGISTRY }}/server-spring:${{ steps.image-tag.outputs.value }}

# 서버로 docker-compose 파일 전송
- name: Copy docker-compose.yml to NCP Server
uses: appleboy/[email protected]
with:
host: ${{ secrets.NCP_HOST }}
username: ${{ secrets.NCP_USERNAME }}
key: ${{ secrets.NCP_PRIVATE_KEY }}
port: ${{ secrets.NCP_PORT }}
source: docker-compose.yaml
target: /home/tenminute/

# 슬랙으로 빌드 스캔 결과 전송
- name: Send to slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Gradle Build Scan Report of ${{ github.workflow }}: ${{ steps.gradle.outputs.build-scan-url }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

deploy:
runs-on: ubuntu-latest
environment: DEV
needs: build
steps:
- name: Deploy to NCP Server
uses: appleboy/ssh-action@master
env:
NCP_CONTAINER_REGISTRY: ${{ secrets.NCP_CONTAINER_REGISTRY }}
NCP_IMAGE_TAG: ${{ needs.build.outputs.image-tag }}
with:
host: ${{ secrets.NCP_HOST }}
username: ${{ secrets.NCP_USERNAME }}
key: ${{ secrets.NCP_PRIVATE_KEY }}
port: ${{ secrets.NCP_PORT }}
envs: NCP_CONTAINER_REGISTRY,NCP_IMAGE_TAG # docker-compose.yml 에서 사용할 환경 변수
script: |
echo "${{ secrets.NCP_SECRET_KEY }}" | docker login -u "${{ secrets.NCP_ACCESS_KEY }}" --password-stdin "${{ secrets.NCP_CONTAINER_REGISTRY }}"
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/server-spring:${{ env.NCP_IMAGE_TAG }}
docker compose -f /home/tenminute/docker-compose.yaml up -d
docker image prune -a -f
30 changes: 30 additions & 0 deletions .github/workflows/develop_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: develop Deploy

on:
workflow_dispatch:
inputs:
commit_hash:
description: 'commit_hash'
required: true

jobs:
deploy:
runs-on: ubuntu-latest
environment: DEV
steps:
- name: Deploy to NCP Server
uses: appleboy/ssh-action@master
env:
NCP_CONTAINER_REGISTRY: ${{ secrets.NCP_CONTAINER_REGISTRY }}
NCP_IMAGE_TAG: ${{ github.event.inputs.commit_hash }}
with:
host: ${{ secrets.NCP_HOST }}
username: tenminute
key: ${{ secrets.NCP_PRIVATE_KEY }}
port: ${{ secrets.NCP_PORT }}
envs: NCP_CONTAINER_REGISTRY,NCP_IMAGE_TAG # docker-compose.yml 에서 사용할 환경 변수
script: |
echo "${{ secrets.NCP_SECRET_KEY }}" | docker login -u "${{ secrets.NCP_ACCESS_KEY }}" --password-stdin "${{ secrets.NCP_CONTAINER_REGISTRY }}"
docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/server-spring:${{ github.event.inputs.commit_hash }}
docker compose -f /home/tenminute/docker-compose.yaml up -d
docker image prune -a -f
45 changes: 45 additions & 0 deletions .github/workflows/develop_pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: develop(pull_request) Check Style And Test
on:
pull_request:
branches:
- develop
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 17 ]
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'adopt'

- name: Start containers # test 돌릴때 레디스 필요
run: docker-compose -f ./docker-compose-test.yaml up -d

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew

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

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: check
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }}

- name: SonarCloud scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew sonar --info --stacktrace
19 changes: 19 additions & 0 deletions .github/workflows/issue_set_merged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Add 'merged' label to closed PR

on:
pull_request:
types:
- closed

jobs:
set_merged:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add 'merged' label to closed PR
run: gh issue edit "$PR_NUMBER" --add-label "merged"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
Loading

0 comments on commit 5de8f6d

Please sign in to comment.