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
35 changes: 35 additions & 0 deletions .github/workflows/android-pull-request-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Android Pull Request CI

on:
pull_request:
branches: [ "main", "develop", "dev" ]

jobs:
build:
runs-on: ubuntu-latest

defaults:
run:
working-directory: Near

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

- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'

- name: set up Android SDK
uses: android-actions/setup-android@v2

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

- name: Run test
run: ./gradlew test --parallel

- name: Run ktlint
run: ./gradlew ktlintCheck
9 changes: 9 additions & 0 deletions Near/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
ktlint_function_naming_ignore_when_annotated_with = Composable
4 changes: 2 additions & 2 deletions Near/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ android {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}
}
Expand Down Expand Up @@ -73,4 +73,4 @@ dependencies {
implementation(libs.room.ktx)
kapt(libs.room.compiler)
implementation(libs.room.paging)
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.alarmy.near

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.*
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.alarmy.near", appContext.packageName)
}
}
}
11 changes: 7 additions & 4 deletions Near/app/src/main/java/com/alarmy/near/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class MainActivity : ComponentActivity() {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "Android",
modifier = Modifier.padding(innerPadding)
modifier = Modifier.padding(innerPadding),
)
}
}
Expand All @@ -31,10 +31,13 @@ class MainActivity : ComponentActivity() {
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
fun Greeting(
name: String,
modifier: Modifier = Modifier,
) {
Text(
text = "Hello $name!",
modifier = modifier
modifier = modifier,
)
}

Expand All @@ -44,4 +47,4 @@ fun GreetingPreview() {
NearTheme {
Greeting("Android")
}
}
}
2 changes: 1 addition & 1 deletion Near/app/src/main/java/com/alarmy/near/NearApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class NearApplication : Application()
class NearApplication : Application()
9 changes: 3 additions & 6 deletions Near/app/src/main/java/com/alarmy/near/db/AppDatabase.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.alarmy.near.db

import androidx.room.Database
import androidx.room.RoomDatabase

// TODO: 실제 Entity, Dao 추가 필요
//@Database(entities = [], version = 1)
//abstract class AppDatabase : RoomDatabase() {
// @Database(entities = [], version = 1)
// abstract class AppDatabase : RoomDatabase() {
// // abstract fun exampleDao(): ExampleDao
//}
// }
24 changes: 4 additions & 20 deletions Near/app/src/main/java/com/alarmy/near/di/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
package com.alarmy.near.di

import android.content.Context
import androidx.room.Room
import com.alarmy.near.repository.ExampleRepository
import com.alarmy.near.repository.ExampleRepositoryImpl
import com.bumptech.glide.Glide
import com.bumptech.glide.RequestManager
import com.google.gson.Gson
import com.google.gson.GsonBuilder
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import javax.inject.Singleton

//@Module
//@InstallIn(SingletonComponent::class)
//object AppModule {
// @Module
// @InstallIn(SingletonComponent::class)
// object AppModule {
// @Provides
// @Singleton
// fun provideGson(): Gson = GsonBuilder().create()
Expand All @@ -44,4 +28,4 @@ import javax.inject.Singleton
// @Provides
// @Singleton
// fun provideExampleRepository(): ExampleRepository = ExampleRepositoryImpl()
//}
// }
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.alarmy.near.repository

interface ExampleRepository {
fun getExampleData(): String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package com.alarmy.near.repository

class ExampleRepositoryImpl : ExampleRepository {
override fun getExampleData(): String = "Hello from Repository"
}
}
5 changes: 2 additions & 3 deletions Near/app/src/test/java/com/alarmy/near/ExampleUnitTest.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package com.alarmy.near

import org.junit.Test

import org.junit.Assert.*
import org.junit.Test

/**
* Example local unit test, which will execute on the development machine (host).
Expand All @@ -14,4 +13,4 @@ class ExampleUnitTest {
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
}
3 changes: 2 additions & 1 deletion Near/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ plugins {
alias(libs.plugins.kotlin.compose) apply false
alias(libs.plugins.hilt.application) apply false
alias(libs.plugins.kotlin.kapt) apply false
}
alias(libs.plugins.ktlint)
}
3 changes: 3 additions & 0 deletions Near/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ retrofitVersion = "2.9.0"
glideVersion = "4.16.0"
# Room
roomVersion = "2.6.1"
# Ktlint
ktlintVersion = "13.0.0"

[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
Expand Down Expand Up @@ -51,4 +53,5 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
hilt-application = { id = "com.google.dagger.hilt.android", version.ref = "hiltVersion" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlintVersion" }

Empty file modified Near/gradlew
100644 → 100755
Empty file.
1 change: 0 additions & 1 deletion Near/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ dependencyResolutionManagement {

rootProject.name = "Near"
include(":app")