Skip to content

Commit

Permalink
Merge pull request #72 from Halulkin/feat/github-actions
Browse files Browse the repository at this point in the history
build: added github actions
  • Loading branch information
levinzonr authored Sep 15, 2023
2 parents 663fbff + e044a21 commit 06e9ba7
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 35 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Build and Test

on:
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 17

- name: Spotless Check
run: ./gradlew spotlessCheck

- name: Detekt Check
run: ./gradlew detekt

- name: Run Tests
run: ./gradlew test
7 changes: 4 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ android {
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get()
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_11.toString()))
languageVersion.set(JavaLanguageVersion.of(JavaVersion.VERSION_17.toString()))
}
}

Expand Down Expand Up @@ -112,6 +112,7 @@ dependencies {
implementation(libs.android.activity.compose)
implementation(libs.android.lifecycle.viewmodel.compose)
implementation(libs.bundles.google.accompanist)
implementation (libs.android.compose.ui.tooling.preview)
debugImplementation(libs.android.compose.ui.tooling)

// Injection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.monstarlab.designsystem.theme.Theme
fun AppTopBar(
title: String,
modifier: Modifier = Modifier,
onBackButtonClick: (() -> Unit)? = null,
onBackButtonClick: (() -> Unit)? = null
) {
TopAppBar(
modifier = modifier,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fun AppButton(
enabled: Boolean = true,
isLoading: Boolean = false,
type: AppButtonType = AppButtonType.Filled,
onClick: () -> Unit,
onClick: () -> Unit
) {
when (type) {
AppButtonType.Filled -> PrimaryButton(
Expand Down Expand Up @@ -67,7 +67,7 @@ private fun PrimaryButton(
modifier: Modifier = Modifier,
onClick: () -> Unit = {},
enabled: Boolean = false,
content: @Composable RowScope.() -> Unit,
content: @Composable RowScope.() -> Unit
) {
val colors = ButtonDefaults.buttonColors()
Button(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun AppTextField(
maxLines: Int = Int.MAX_VALUE,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
trailingIcon: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null,
leadingIcon: @Composable (() -> Unit)? = null
) {
Column {
OutlinedTextField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ class AuthRepositoryImpl @Inject constructor(
val responseBody = api.postLogin(email, password)
return responseBody.toAuthToken()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.monstarlab.features.auth.domain.repository

import com.monstarlab.features.auth.domain.models.AuthToken


interface AuthRepository {
suspend fun login(email: String, password: String) : AuthToken
}
suspend fun login(email: String, password: String): AuthToken
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface RepositoryModule {

@Binds
@Singleton
fun bindAuthRepository(repositoryImpl: AuthRepositoryImpl) : AuthRepository
}
fun bindAuthRepository(repositoryImpl: AuthRepositoryImpl): AuthRepository
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ class LoginUseCase @Inject constructor(
authRepository.login(email, password)
userRepository.get()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class LoginViewModel @Inject constructor(
_stateFlow.update { it.copy(isLoading = true) }
val state = _stateFlow.value
val result = loginUseCase(state.email, state.password)
_stateFlow.update { state ->
state.copy(
_stateFlow.update { loginState ->
loginState.copy(
error = result.exceptionOrNull()?.toError(),
isLoading = false,
isLoggedIn = result.isSuccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,4 @@ class MainActivity : AppCompatActivity(R.layout.activity_main) {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ class MainActivityViewModel @Inject constructor(
)
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ class SetupNstackUseCase @Inject constructor(
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ class ResourceRepositoryImpl @Inject constructor(
resourcePreferenceStore.addAll(it)
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,3 @@ import com.monstarlab.features.resources.domain.model.Resource
interface ResourceRepository {
suspend fun get(): List<Resource>
}


Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ interface RepositoryModule {

@Binds
@Singleton
fun bindResourceRepository(resourceRepository: ResourceRepositoryImpl) : ResourceRepository
}
fun bindResourceRepository(resourceRepository: ResourceRepositoryImpl): ResourceRepository
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import javax.inject.Inject
class UserRepositoryImpl @Inject constructor(
private val api: UsersApi,
private val userPreferenceStore: UserPreferenceStore,
) : UserRepository {
) : UserRepository {

override suspend fun get(): User {
return api.getUser().data.toUser().also {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ package com.monstarlab.features.user.domain.repository
import com.monstarlab.features.user.domain.model.User

interface UserRepository {
suspend fun get() : User
}
suspend fun get(): User
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,5 @@ interface RepositoryModule {

@Binds
@Singleton
fun bindUserRepository(repository: UserRepositoryImpl) : UserRepository

}
fun bindUserRepository(repository: UserRepositoryImpl): UserRepository
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,5 @@ internal class AuthRepositoryTest {
// Assert
assertEquals(expectedTokenResponseDTO.toAuthToken(), actualAuthToken)
coVerify(exactly = 1) { mockAuthApi.postLogin(email, password) }

}

}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subprojects {
kotlin {
target("**/*.kt")
targetExclude("**/RateReminderActions.kt")
ktlint()
ktlint("0.40.0")
}
}
}
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ android_compose_ui = { module = "androidx.compose.ui:ui" }
android_compose_material = { module = "androidx.compose.material:material" }
android_compose_ui_util = { module = "androidx.compose.ui:ui-util" }
android_compose_ui_tooling = { module = "androidx.compose.ui:ui-tooling" }
android_compose_ui_tooling_preview = { module = "androidx.compose.ui:ui-tooling-preview" }
android_compose_runtime = { module = "androidx.compose.runtime:runtime-livedata" }
android_compose_ui_test = { module = "androidx.compose.ui:ui-test-junit4" }
android_compose_ui_test_manifest = { module = "androidx.compose.ui:ui-test-manifest" }
Expand Down

0 comments on commit 06e9ba7

Please sign in to comment.