Skip to content

Commit

Permalink
v0.1.0 (#412)
Browse files Browse the repository at this point in the history
v0.1.0
  • Loading branch information
Leejin-Yang authored Aug 12, 2023
2 parents dbc5e3f + 7be8a27 commit 3b8eeef
Show file tree
Hide file tree
Showing 349 changed files with 26,632 additions and 40 deletions.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ assignees: ''
## 어떤 기능을 구현하나요?

- 구현 할 기능을 작성합니다.

## 일정

- 추정 시간
5 changes: 5 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
## 🎸 기타

- 특이 사항이 있으면 작성합니다.

## ⏰ 일정

- 추정 시간 :
- 걸린 시간 :
17 changes: 17 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
# What's Changed
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: '🔑 FE'
labels:
- '🔑 FE'
- title: '🔒 BE'
labels:
- '🔒 BE'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: 릴리즈 노트 작성

on:
push:
branches:
- main
tags:
- v*.*.*

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: 저장소 가져오기
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: 버전 가져오기
id: version
run: |
tag=${GITHUB_REF/refs\/tags\//}
version=${tag#v}
major=${version%%.*}
echo "tag=${tag}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT
echo "major=${major}" >> $GITHUB_OUTPUT
- name: 릴리즈 노트 작성
uses: release-drafter/release-drafter@master
with:
version: ${{ steps.version.outputs.version }}
publish: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 changes: 76 additions & 0 deletions .github/workflows/test-fe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Frontend PR Test

on:
pull_request:
branches:
- main
- develop
paths:
- '.github/**'
- 'frontend/**'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
checks: write
pull-requests: write

steps:
- name: Repository 체크아웃
uses: actions/checkout@v3

- name: Node 설정
uses: actions/setup-node@v3
with:
node-version: '18.16.1'

- name: node_modules 캐싱
id: cache
uses: actions/cache@v3
with:
path: '**/frontend/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: 의존성 설치
working-directory: frontend/
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --pure-lockfile

- name: 테스트 실행
working-directory: frontend/
run: yarn test
continue-on-error: true

- name: 테스트 결과 PR에 코멘트 등록
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: '**/frontend/test-results/results.xml'

- name: 테스트 실패 시, 실패한 코드 라인에 Check 코멘트를 등록
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/frontend/test-results/results.xml'
token: ${{ github.token }}

- name: build 실패 시 Slack으로 알립니다
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: 프론트엔드 테스트 실패 알림
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_CHANNEL: group-dev
SLACK_COLOR: '#FF2D00'
SLACK_USERNAME: 'Github Action'
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 }}
if: failure()
76 changes: 76 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: PR Test

on:
pull_request:
branches:
- main
- develop
paths:
- '.github/**'
- 'backend/**'

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 10

permissions:
checks: write
pull-requests: write

steps:
- name: Repository 체크아웃
uses: actions/checkout@v3

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

- 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: Gradle 권한 부여
working-directory: backend/
run: chmod +x ./gradlew

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

- name: 테스트 결과 PR에 코멘트 등록
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: '**/backend/build/test-results/test/TEST-*.xml'

- name: 테스트 실패 시, 실패한 코드 라인에 Check 코멘트를 등록
uses: mikepenz/action-junit-report@v3
if: always()
with:
report_paths: '**/backend/build/test-results/test/TEST-*.xml'
token: ${{ github.token }}

- name: build 실패 시 Slack으로 알립니다
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
author_name: 백엔드 테스트 실패 알림
fields: repo, message, commit, author, action, eventName, ref, workflow, job, took
env:
SLACK_CHANNEL: group-dev
SLACK_COLOR: '#FF2D00'
SLACK_USERNAME: 'Github Action'
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 }}
if: failure()
31 changes: 20 additions & 11 deletions backend/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
plugins {
id 'java'
id 'org.springframework.boot' version '2.7.13'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
id 'java'
id 'org.springframework.boot' version '2.7.13'
id 'io.spring.dependency-management' version '1.0.15.RELEASE'
}

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

java {
sourceCompatibility = '11'
sourceCompatibility = '11'
}

repositories {
mavenCentral()
mavenCentral()
}

dependencies {
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'
testRuntimeOnly 'com.h2database:h2'
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:4.4.0'
testRuntimeOnly 'com.h2database:h2'

implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
implementation 'commons-fileupload:commons-fileupload:1.5'
implementation 'commons-io:commons-io:2.11.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'
}

tasks.named('test') {
useJUnitPlatform()
useJUnitPlatform()
}
31 changes: 31 additions & 0 deletions backend/src/main/java/com/funeat/auth/application/AuthService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.funeat.auth.application;

import com.funeat.auth.dto.SignUserDto;
import com.funeat.auth.dto.UserInfoDto;
import com.funeat.auth.util.PlatformUserProvider;
import com.funeat.member.application.MemberService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = true)
public class AuthService {

private final MemberService memberService;
private final PlatformUserProvider platformUserProvider;

public AuthService(final MemberService memberService, final PlatformUserProvider platformUserProvider) {
this.memberService = memberService;
this.platformUserProvider = platformUserProvider;
}

public SignUserDto loginWithKakao(final String code) {
final UserInfoDto userInfoDto = platformUserProvider.getPlatformUser(code);
final SignUserDto signUserDto = memberService.findOrCreateMember(userInfoDto);
return signUserDto;
}

public String getLoginRedirectUri() {
return platformUserProvider.getRedirectURI();
}
}
53 changes: 53 additions & 0 deletions backend/src/main/java/com/funeat/auth/dto/KakaoTokenDto.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package com.funeat.auth.dto;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;

public class KakaoTokenDto {

private final String accessToken;
private final String tokenType;
private final String refreshToken;
private final String expiresIn;
private final String scope;
private final String refreshTokenExpiresIn;

@JsonCreator
public KakaoTokenDto(@JsonProperty("access_token") final String accessToken,
@JsonProperty("token_type") final String tokenType,
@JsonProperty("refresh_token") final String refreshToken,
@JsonProperty("expires_in") final String expiresIn,
@JsonProperty("scope") final String scope,
@JsonProperty("refresh_token_expires_in") final String refreshTokenExpiresIn) {
this.accessToken = accessToken;
this.tokenType = tokenType;
this.refreshToken = refreshToken;
this.expiresIn = expiresIn;
this.scope = scope;
this.refreshTokenExpiresIn = refreshTokenExpiresIn;
}

public String getAccessToken() {
return accessToken;
}

public String getTokenType() {
return tokenType;
}

public String getRefreshToken() {
return refreshToken;
}

public String getExpiresIn() {
return expiresIn;
}

public String getScope() {
return scope;
}

public String getRefreshTokenExpiresIn() {
return refreshTokenExpiresIn;
}
}
Loading

0 comments on commit 3b8eeef

Please sign in to comment.