Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
songkg7 committed Sep 6, 2023
0 parents commit b375fd6
Show file tree
Hide file tree
Showing 14 changed files with 580 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# .editorconfig

root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120

[*.{kt,kts}]
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_allow_trailing_comma = true
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# *.kt *.kts @songkg7
/.github/ @songkg7
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## ✏️ 구현 내용

[//]: # (- 구현한 내용, 혹은 구현하고자 한 내용에 대해서 간단하게 적어주세요!)

## 🤔 논의하고 싶은 내용 / 질문 등

[//]: # (- 학습 내용 기반의 추가적인 논의나 질문 거리에 대해서 작성해주세요)
32 changes: 32 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: codecov
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
env:
OS: ${{ matrix.os }}
steps:
- uses: actions/checkout@master
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Generate coverage report
run: ./gradlew testCoverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
env_vars: OS
file: ./build/reports/jacoco/test/jacocoTestReport.xml
18 changes: 18 additions & 0 deletions .github/workflows/ktlint-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ktlint
on:
pull_request:
branches: [ main ]
jobs:
ktlint:
name: Check Code Quality
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@master
with:
fetch-depth: 1
- name: ktlint
uses: ScaCap/action-ktlint@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
fail_on_error: true
42 changes: 42 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

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

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

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Kotlin Lotto

## 목표

우리가 집중해야하는 것들입니다.

- 단순한 로또뿐만 아니라 미국의 슈퍼볼 방식도 가능하다면 재미있지 않을까?
- 이 코드를 보니 팀원이 뭔가 구현하려던거 같은데 그게 뭘까?
- 어떻게 코드를 작성해야 다음 팀원이 이해하기 쉬울까?
- 사용해보고 싶었던 기술이 있었는데 한 번 이야기를 나눠보자!

이 스터디는 **요구사항 및 기능을 직접 정의**해나가면서, **페어 프로그래밍을 위한 커뮤니케이션**에 초점을 맞추고 있어요. 부담갖지 마시고 하고 싶은 모든 걸 해보시기 바랍니다. 이전 팀원이 추가한 기술이나 구현 방식이 새롭게 다가오는 기술이라면, 이야기해볼 수 있는 좋은 기회가 될거에요!

## 진행 과정

먼저 모든 팀원은 미션 저장소를 자신의 개인 저장소로 fork 합니다.

1. 기능과 관련된 적절한 이름의 branch 를 생성 후 commit 합니다.
2. 2번의 과정이 끝나면 local 에만 변경사항이 반영되어 있으므로 본인의 remote 저장소에 push 합니다.
3. 본인의 remote 저장소에 push 가 완료되면, github 에서 pull request 를 생성합니다.
4. (Optional) 아직 기능이 완성되진 않았지만, 진행상황 공유 등의 이유로 PR 을 먼저 생성하고 싶다면 draft 로 생성합니다.
5. Ready 상태의 PR 이 생성되면 리뷰어들은 코드 리뷰를 시작합니다.
6. 리뷰가 완료되면 assignee 는 PR 을 merge 하고, 다음 주차의 assignee 는 위 과정을 반복합니다.

## 규칙

- PR 은 다음 팀원이 이어서 진행하기 쉽도록 가급적 본인이 생각하는 가장 작은 기능 단위로 생성해주세요
- 중간에 구현이 막혔다면, 어떤걸 하려했고 어떤 부분이 막혔는지를 대략적으로 적어두고 PR 을 생성해주세요
- 이것밖에 구현 못했는데 괜찮나? 라고 생각하지 않아도 괜찮습니다. 그냥 마음편히 던지세요! 코드의 절대적인 양은 이 스터디에서 중요하지 않습니다.
- 테스트 코드를 작성해주세요
- 항상 실행가능한 상태를 유지해주세요
- Kotest Spec 은 AnnotationSpec 을 제외한 나머지를 선호에 따라 자유롭게 사용합니다
- Ktlint 는 가급적 모두 통과시켜주세요
- 다소 엄격하다고 생각될 수 있지만, Standard rule 로 설정되어 있으므로 Kotlin 진영에서 권장하는 스타일은 무엇인지 살펴볼 수 있는 기회가 될거에요

## 가이드

아래는 로또에 대한 가장 기본적인 규칙이에요. 뭘 구현해야할지 막막하다면 현재 진행상황과 아래 규칙을 비교해보세요!

- 구입 금액 입력
- 구입 금액에 따라 1장에 1000원씩 계산하여 로또 발급하기
- 로또 한장에는 6개의 숫자가 담겨있다
- 수동으로 구매한 로또 수 입력
- 입력한 금액을 벗어나는 경우 예외 처리
- 수동 로또수에 따라 하나의 로또당 6개의 번호를 입력해야함
- 수동 로또를 제외하고 나머지 금액은 자동 로또 발급
- 지난 주 당첨 번호와 보너스볼을 입력
- 당첨번호와 보너스볼과 일치하는 개수에 따라 통계를 내기
- 통계에는 3개 일치, 4개 일치, 5개 일치, 5개 일치 + 보너스볼 , 6개 일치하는 로또 개수를 보여주고, 수익률을 계산한다.(기준 1)
- 수익률은 당첨 금액 / 원금 으로 계산한다.
75 changes: 75 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
plugins {
kotlin("jvm") version "1.9.0"
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
jacoco
}

jacoco {
toolVersion = "0.8.8"
}

group = "org.livid"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()
}

val kotestVersion = "5.7.2"

dependencies {
testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
testImplementation(kotlin("test"))
}

tasks.test {
extensions.configure(JacocoTaskExtension::class) {
destinationFile = file("$buildDir/jacoco/jacoco.exec")
}

finalizedBy("jacocoTestReport")
}

tasks.test {
useJUnitPlatform()
}

tasks.jacocoTestReport {
reports {
html.required.set(true)
xml.required.set(true)
csv.required.set(false)
}

finalizedBy("jacocoTestCoverageVerification")
}

tasks.jacocoTestCoverageVerification {
violationRules {
rule {
element = "CLASS"
limit {
minimum = "0.70".toBigDecimal()
}
}
}
}

kotlin {
jvmToolchain(8)
}

val testCoverage by tasks.registering {
group = "verification"
description = "Runs the unit tests with coverage"

dependsOn(
":test",
":jacocoTestReport",
":jacocoTestCoverageVerification"
)

tasks["jacocoTestReport"].mustRunAfter(tasks["test"])
tasks["jacocoTestCoverageVerification"].mustRunAfter(tasks["jacocoTestReport"])
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
kotlin.code.style=official
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit b375fd6

Please sign in to comment.