Skip to content
This repository was archived by the owner on Jan 20, 2023. It is now read-only.

Commit e25b715

Browse files
authored
Merge pull request #1 from k163377/add_ci
CI関連の項目追加 + Kotlinのアップデート + フォーマッティング
2 parents 1571693 + 258fa45 commit e25b715

File tree

6 files changed

+53
-18
lines changed

6 files changed

+53
-18
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# This workflow will build a Java project with Gradle
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3-
4-
name: Test with Gradle
1+
name: Lint, Test, and upload Coveradge with Gradle.
52

63
on:
74
push:
@@ -22,5 +19,11 @@ jobs:
2219
java-version: 1.8
2320
- name: Grant execute permission for gradlew
2421
run: chmod +x gradlew
22+
- name: ktlint check
23+
run: ./gradlew ktlintCheck
2524
- name: Test with Gradle
2625
run: ./gradlew test
26+
- name: upload coverage
27+
uses: codecov/codecov-action@v1
28+
with:
29+
token: ${{ secrets.CODECOV_TOKEN }}

build.gradle.kts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
plugins {
2-
kotlin("jvm") version "1.4.10"
2+
kotlin("jvm") version "1.4.20"
3+
id("org.jlleitschuh.gradle.ktlint") version "9.4.1"
4+
id("jacoco")
35
}
46

57
group = "com.mapk"
@@ -31,7 +33,16 @@ tasks {
3133
jvmTarget = "1.8"
3234
}
3335
}
36+
jacocoTestReport {
37+
reports {
38+
xml.isEnabled = true
39+
csv.isEnabled = false
40+
html.isEnabled = true
41+
}
42+
}
3443
test {
3544
useJUnitPlatform()
45+
// テスト終了時にjacocoのレポートを生成する
46+
finalizedBy(jacocoTestReport)
3647
}
3748
}

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
rootProject.name = "FastKFunction"
2-

src/test/kotlin/com/mapk/fastkfunction/argumentBucket/ArgumentBucketTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package com.mapk.fastkfunction.argumentBucket
22

33
import com.mapk.fastkfunction.argumentbucket.ArgumentBucket
44
import com.mapk.fastkfunction.argumentbucket.BucketGenerator
5-
import org.junit.jupiter.api.Assertions.*
5+
import org.junit.jupiter.api.Assertions.assertEquals
6+
import org.junit.jupiter.api.Assertions.assertNull
7+
import org.junit.jupiter.api.Assertions.assertTrue
68
import org.junit.jupiter.api.Nested
79
import org.junit.jupiter.api.Test
810

src/test/kotlin/com/mapk/fastkfunction/fastkfunction/FullInitializedCallTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import kotlin.reflect.full.companionObject
1414
import kotlin.reflect.full.companionObjectInstance
1515
import kotlin.reflect.full.functions
1616

17-
private fun topLevelFunc(arg1: Int, arg2: String): FullInitializedCallTest.Dst =
17+
private fun topLevelFunc(arg1: Int, arg2: String): FullInitializedCallTest.Dst =
1818
FullInitializedCallTest.Dst(arg1, arg2)
1919

2020
private fun FullInitializedCallTest.Class.topLevelExtensionFunc(arg1: Int, arg2: String): FullInitializedCallTest.Dst =

src/test/kotlin/com/mapk/fastkfunction/fastkfunction/UseDefaultValueCallTest.kt

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,27 @@ enum class DefaultValues {
2929
}
3030

3131
private fun topLevelFunc(
32-
arg1: Int, arg2: String, arg3: String = DefaultValues.TopLevelFunc.name
32+
arg1: Int,
33+
arg2: String,
34+
arg3: String = DefaultValues.TopLevelFunc.name
3335
): UseDefaultValueCallTest.Dst = UseDefaultValueCallTest.Dst(arg1, arg2, arg3)
3436

3537
private fun UseDefaultValueCallTest.Class.topLevelExtensionFunc(
36-
arg1: Int, arg2: String, arg3: String = DefaultValues.TopLevelExtensionFunc.name
38+
arg1: Int,
39+
arg2: String,
40+
arg3: String = DefaultValues.TopLevelExtensionFunc.name
3741
): UseDefaultValueCallTest.Dst = UseDefaultValueCallTest.Dst(arg1, arg2, arg3)
3842

3943
private fun UseDefaultValueCallTest.Class.topLevelExtensionFuncFromInstance(
40-
arg1: Int, arg2: String, arg3: String = DefaultValues.TopLevelExtensionFuncFromInstance.name
44+
arg1: Int,
45+
arg2: String,
46+
arg3: String = DefaultValues.TopLevelExtensionFuncFromInstance.name
4147
): UseDefaultValueCallTest.Dst = UseDefaultValueCallTest.Dst(arg1, arg2, arg3)
4248

4349
private fun UseDefaultValueCallTest.Class.topLevelExtensionFuncFromInstanceWithInstance(
44-
arg1: Int, arg2: String, arg3: String = DefaultValues.TopLevelExtensionFuncFromInstanceWithInstance.name
50+
arg1: Int,
51+
arg2: String,
52+
arg3: String = DefaultValues.TopLevelExtensionFuncFromInstanceWithInstance.name
4553
): UseDefaultValueCallTest.Dst = UseDefaultValueCallTest.Dst(arg1, arg2, arg3)
4654

4755
/**
@@ -68,15 +76,21 @@ private class UseDefaultValueCallTest {
6876
Dst(arg1, arg2, arg3)
6977

7078
fun ofWithInstance(
71-
arg1: Int, arg2: String, arg3: String = DefaultValues.CompanionObjectFuncWithInstance.name
79+
arg1: Int,
80+
arg2: String,
81+
arg3: String = DefaultValues.CompanionObjectFuncWithInstance.name
7282
) = Dst(arg1, arg2, arg3)
7383

7484
fun ofFromReflection(
75-
arg1: Int, arg2: String, arg3: String = DefaultValues.CompanionObjectFuncFromReflection.name
85+
arg1: Int,
86+
arg2: String,
87+
arg3: String = DefaultValues.CompanionObjectFuncFromReflection.name
7688
) = Dst(arg1, arg2, arg3)
7789

7890
fun ofFromReflectionWithInstance(
79-
arg1: Int, arg2: String, arg3: String = DefaultValues.CompanionObjectFuncFromReflectionWithInstance.name
91+
arg1: Int,
92+
arg2: String,
93+
arg3: String = DefaultValues.CompanionObjectFuncFromReflectionWithInstance.name
8094
) = Dst(arg1, arg2, arg3)
8195
}
8296
}
@@ -85,7 +99,9 @@ private class UseDefaultValueCallTest {
8599
Dst(arg1, arg2, arg3)
86100

87101
private fun instanceFunctionWithInstance(
88-
arg1: Int, arg2: String, arg3: String = DefaultValues.InstanceFuncWithInstance.name
102+
arg1: Int,
103+
arg2: String,
104+
arg3: String = DefaultValues.InstanceFuncWithInstance.name
89105
) = Dst(arg1, arg2, arg3)
90106

91107
@ParameterizedTest
@@ -115,7 +131,9 @@ private class UseDefaultValueCallTest {
115131
Arguments.of(::instanceFunctionWithInstance, this, DefaultValues.InstanceFuncWithInstance),
116132
Arguments.of((Dst)::of, null, DefaultValues.CompanionObjectFunc),
117133
Arguments.of(
118-
(Dst)::ofWithInstance, Dst::class.companionObjectInstance, DefaultValues.CompanionObjectFuncWithInstance
134+
(Dst)::ofWithInstance,
135+
Dst::class.companionObjectInstance,
136+
DefaultValues.CompanionObjectFuncWithInstance
119137
),
120138
Arguments.of(ofFromReflection, null, DefaultValues.CompanionObjectFuncFromReflection),
121139
Arguments.of(
@@ -127,7 +145,9 @@ private class UseDefaultValueCallTest {
127145
Arguments.of(Class::topLevelExtensionFunc, Class(), DefaultValues.TopLevelExtensionFunc),
128146
Class().let {
129147
Arguments.of(
130-
it::topLevelExtensionFuncFromInstance, null, DefaultValues.TopLevelExtensionFuncFromInstance
148+
it::topLevelExtensionFuncFromInstance,
149+
null,
150+
DefaultValues.TopLevelExtensionFuncFromInstance
131151
)
132152
},
133153
Class().let {

0 commit comments

Comments
 (0)