diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 70849b4..21014ca 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -5,10 +5,12 @@ on: # branches: [ main, develop ] pull_request: branches: [ main, develop ] + schedule: + - cron: '* 7 * * *' jobs: - unit_test: - name: UnitTest + android_lint: + name: AndroidLint runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -25,15 +27,8 @@ jobs: - name: Clone Submodule run: git clone https://github.com/beomjo/android-compilation.git - - name: Unit Test - run: ./gradlew testDebugUnitTest - - - name: Android Test Report - uses: asadmansr/android-test-report-action@v1.2.0 - if: ${{ always() }} - with: - name: reports - path: app/build/test-results + - name: Run Android Lint + run: ./gradlew lintRelease - name: Workflow Failed Notification to Slack uses: rtCamp/action-slack-notify@v2 @@ -47,10 +42,8 @@ jobs: SLACK_USERNAME: Github Notification SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - ktlint: name: ktlint - needs: unit_test runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -85,7 +78,6 @@ jobs: detekt: name: detekt - needs: [ unit_test, ktlint ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -117,9 +109,52 @@ jobs: SLACK_USERNAME: Github Notification SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + unit_test: + name: UnitTest + needs: [ android_lint, ktlint, detekt ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Clone Submodule + run: git clone https://github.com/beomjo/android-compilation.git + + - name: Unit Test + run: ./gradlew testDebugUnitTest + + - name: Android Test Report + uses: asadmansr/android-test-report-action@v1.2.0 + if: ${{ always() }} + with: + name: reports + path: app/build/test-results + + - name: Workflow Failed Notification to Slack + uses: rtCamp/action-slack-notify@v2 + if: ${{ failure() }} + env: + SLACK_CHANNEL: github-notification + SLACK_COLOR: ${{ job.status }} + SLACK_ICON: https://user-images.githubusercontent.com/39984656/126071498-60496f8c-4971-4bb1-9609-2cab573c1079.png + SLACK_MESSAGE: '[${{ github.workflow }}.${{ github.action }}] Failed!! :rage:' + SLACK_TITLE: Message + SLACK_USERNAME: Github Notification + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + + build: name: Build - needs: [ unit_test, ktlint, detekt ] + needs: [ android_lint, ktlint, detekt, unit_test ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/upload_aab_to_play_store.yml b/.github/workflows/upload_aab_to_play_store.yml index f31b9ba..b08d37b 100644 --- a/.github/workflows/upload_aab_to_play_store.yml +++ b/.github/workflows/upload_aab_to_play_store.yml @@ -54,6 +54,15 @@ jobs: - name: Clean Project run: ./gradlew clean --stacktrace + - name: Run Android Lint + run: ./gradlew lintRelease + + - name: Run ktlint + run: ./gradlew ktlintCheck + + - name: Run detekt + run: ./gradlew detekt + - name: Unit Test run: ./gradlew testDebugUnitTest @@ -64,12 +73,6 @@ jobs: name: reports path: app/build/test-results # path to where the xml test results are stored - - name: Run ktlint - run: ./gradlew ktlintCheck - - - name: Run detekt - run: ./gradlew detekt - - name: Build AAB run: ./gradlew bundleRelease --stacktrace diff --git a/.gitignore b/.gitignore index e9fadbe..1fc749b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ local.properties .idea/gradle.xml .idea/vcs.xml .idea +.idea/ diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 8324c3a..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -White Noise Player \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 61a9130..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index a5f05cd..0000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index d5d35ec..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index 2213a51..0000000 --- a/app/build.gradle +++ /dev/null @@ -1,162 +0,0 @@ -plugins { - id 'com.android.application' - id 'kotlin-android' - id 'kotlin-kapt' - id 'com.google.gms.google-services' - id 'kotlin-parcelize' - id 'com.google.firebase.crashlytics' - id 'scabbard.gradle' - id 'dagger.hilt.android.plugin' - id 'org.jlleitschuh.gradle.ktlint' - id 'io.gitlab.arturbosch.detekt' version '1.18.0-RC2' -} - -class Version { - static final String FILE_NAME = 'version.properties' - int code - String name -} - -def loadConfigFile(String fileName) { - String projPath = getProjectDir().getPath() + "/config" - Properties prop = new Properties() - FileInputStream fis - try { - fis = new FileInputStream(projPath + "/" + fileName) - prop.load(fis) - } catch (IOException e) { - System.out.println(e.toString()) - } - return prop -} - -def getVersionProperty() { - Properties prop = loadConfigFile(Version.FILE_NAME) - - Version version = new Version() - version.code = prop.getProperty("version.code", "1").toInteger() - version.name = prop.getProperty("version.name", "1") - - return version -} - -android { - compileSdkVersion versions.compile_sdk_version - buildToolsVersion versions.build_tool_version - - Version version = getVersionProperty() - - defaultConfig { - applicationId "com.beomjo.whitenoise" - minSdkVersion versions.min_sdk_version - targetSdkVersion versions.target_sdk_version - versionCode version.code - versionName version.name - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } - buildFeatures { - dataBinding true - } - scabbard { - enabled true - failOnError true - fullBindingGraphValidation true - } -} - -dependencies { - implementation project(":android-compilation") - - implementation deps.kotlin.sdk - implementation deps.kotlin.coroutines_core - implementation deps.kotlin.coroutines_android - - implementation deps.androidx.core_ktx - implementation deps.androidx.material - implementation deps.androidx.constraint_layout - implementation deps.androidx.app_compat - implementation deps.androidx.lifecycle_viewmodel_ktx - implementation deps.androidx.lifecycle_livedata_ktx - implementation deps.androidx.activity_ktx - implementation deps.androidx.fragment_ktx - implementation deps.androidx.swipe_refresh - implementation deps.library.rxjava - implementation deps.library.rxandroid - implementation deps.library.rxkotlin - implementation deps.library.okhttp - implementation deps.library.okhttp_logging_interceptor - implementation deps.library.retrofit2 - implementation deps.library.converter_gson - implementation deps.library.material - implementation deps.library.gson - implementation deps.library.rxbinding_kotlin - implementation deps.library.jsoup - implementation deps.library.lottie - - implementation deps.library.glide - kapt deps.kapt.glide_compiler - - implementation platform('com.google.firebase:firebase-bom:26.5.0') - implementation 'com.google.firebase:firebase-auth-ktx' - implementation 'com.google.firebase:firebase-firestore-ktx' - implementation 'com.google.android.gms:play-services-auth:19.0.0' - implementation 'com.google.firebase:firebase-storage-ktx' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.4.3' - implementation 'com.google.firebase:firebase-crashlytics' - - implementation deps.hilt.android - kapt deps.hilt.compiler - - implementation "com.github.skydoves:bindables:1.0.5" - implementation 'com.facebook.shimmer:shimmer:0.5.0' - implementation 'androidx.media:media:1.3.1' - implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0' - - testImplementation deps.test.junit - testImplementation deps.test.arch.core - testImplementation deps.test.androidx_test_core - testImplementation deps.test.coroutine_test - testImplementation deps.test.mockk - testImplementation "org.jetbrains.kotlin:kotlin-reflect:1.5.10" - androidTestImplementation deps.test.runner - androidTestImplementation deps.test.espresso_core -} - -ktlint { - android.set(true) - outputToConsole.set(true) - outputColorName.set("RED") - reporters { - reporter "checkstyle" - reporter "plain" - } - additionalEditorconfigFile.set(file(".editorconfig")) -} - -detekt { - buildUponDefaultConfig = true - allRules = false - config = files("$projectDir/config/detekt.yml") - - reports { - html.enabled = true - xml.enabled = true - txt.enabled = true - sarif.enabled = true - } -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 0000000..6884d0e --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,110 @@ +plugins { + android + `kotlin-android` + `kotlin-kapt` + id("com.google.gms.google-services") + `kotlin-parcelize` + id("com.google.firebase.crashlytics") + id("scabbard.gradle") + id("dagger.hilt.android.plugin") + `detekt-setting` + `ktlint-setting` + id("com.google.android.gms.oss-licenses-plugin") +} + +val version = Project.Version.value + +android { + compileSdkVersion(Project.Config.ANDROID_COMPILE) + buildToolsVersion = Project.Config.BUILD_TOOL + + defaultConfig { + applicationId = "com.beomjo.whitenoise" + minSdkVersion(Project.Config.ANDROID_MIN) + targetSdkVersion(Project.Config.ANDROID_TARGET) + vectorDrawables.useSupportLibrary = true + versionCode = version.code + versionName = version.name + + testInstrumentationRunner = Dependencies.Test.ANDROID_JUNIT_RUNNER + } + + buildTypes { + getByName("release") { + minifyEnabled(true) + proguardFiles( + getDefaultProguardFile( + "proguard-android-optimize.txt" + ), + "proguard-rules.pro" + ) + } + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8.toString() + } + + buildFeatures { + dataBinding = true + } +} + +dependencies { + implementation(project(":android-compilation")) + + implementation(Dependencies.Kotlin.SDK) + implementation(Dependencies.Kotlin.COROUTINE_CORE) + implementation(Dependencies.Kotlin.COROUTINE_ANDROID) + implementation(Dependencies.Kotlin.COROUTINE_PLAY_SERVICE) + + implementation(Dependencies.AndroidX.MATERIAL) + implementation(Dependencies.AndroidX.CONSTRAINT_LAYOUT) + implementation(Dependencies.AndroidX.APP_COMPAT) + implementation(Dependencies.AndroidX.SWIPE_REFRESH_LAYOUT) + implementation(Dependencies.AndroidX.MEDIA) + + implementation(Dependencies.KTX.CORE) + implementation(Dependencies.KTX.LIFECYCLE_LIVEDATA) + implementation(Dependencies.KTX.LIFECYCLE_VIEWMODEL) + implementation(Dependencies.KTX.ACTIVITY) + implementation(Dependencies.KTX.FRAGMENT) + implementation(Dependencies.KTX.FRAGMENT) + + implementation(platform(Dependencies.Firebase.BOM)) + implementation(Dependencies.Firebase.AUTH) + implementation(Dependencies.Firebase.FIRESTORE) + implementation(Dependencies.Firebase.GMS_PLAY_SERVICE_AUTH) + implementation(Dependencies.Firebase.STORAGE) + implementation(Dependencies.Firebase.CRASHLYTICS) + + implementation(Dependencies.Google.MATERIAL) + implementation(Dependencies.Google.GSON) + implementation(Dependencies.Google.OSS_LISENCE) + + implementation(Dependencies.Glide.CORE) + kapt(Dependencies.Glide.APT) + + implementation(Dependencies.Hilt.CORE) + kapt(Dependencies.Hilt.APT) + + implementation(Dependencies.Lottie.CORE) + + implementation(Dependencies.BINDABLES) + implementation(Dependencies.SHIMMER) + implementation(Dependencies.GOOGLE_BUTTON) + + testImplementation(Dependencies.Test.JUNIT) + testImplementation(Dependencies.Test.ARCH_CORE) + testImplementation(Dependencies.Test.ANDROIDX_TEST_CORE) + testImplementation(Dependencies.Test.COROUTINE_TEST) + testImplementation(Dependencies.Test.MOCKK) + testImplementation(Dependencies.Kotlin.REFLECTION) + androidTestImplementation(Dependencies.AndroidTest.TEST_RUNNER) + androidTestImplementation(Dependencies.AndroidTest.ESPRESSO_CORE) +} diff --git a/app/config/version.properties b/app/config/version.properties deleted file mode 100644 index 4b4c05e..0000000 --- a/app/config/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -version.code=2021072101 -version.name=1.0.3 diff --git a/app/release_note.txt b/app/release_note.txt index ab1ef7d..8b5a7c2 100644 --- a/app/release_note.txt +++ b/app/release_note.txt @@ -10,9 +10,14 @@ # Bug Fixes - * [#24] 설정페이지 버전정보 표시 - * [#45] 앱 진입시 RefreshProgressBar 표시하지 않도록 변경 - * [#48] 설정화면 오픈소스라이센스 추가 + * [#52] buildSrc 설정, kotlin dsl로 변경 + * [#54] Worfkflow 수정 + * Android CI 실행 순서 변경 + * ktlin, detekt 실행 후 UnitTest 실행 + * Android Lint Job 추가 + * 데일리 빌드 Schedule설정 + * [#56] Setting -> OpenSourceLicense 표시안되는 현상 + * [#58] Google Login Button 수정 diff --git a/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerService.kt b/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerService.kt index 2c82764..742eb22 100644 --- a/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerService.kt +++ b/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerService.kt @@ -142,7 +142,9 @@ class PlayerService : MediaBrowserServiceCompat() { this@PlayerService, track ) - PlayerAction.STOP -> throw IllegalStateException() + PlayerAction.STOP -> { + TODO("The action cannot be called. [PlayerAction.STOP]") + } } } diff --git a/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerServiceConnection.kt b/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerServiceConnection.kt index a1961bb..d6fc7f4 100644 --- a/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerServiceConnection.kt +++ b/app/src/main/java/com/beomjo/whitenoise/ui/player/PlayerServiceConnection.kt @@ -93,10 +93,11 @@ class PlayerServiceConnection @Inject constructor( } fun setLoop(value: Boolean) { - val repeatMode = if (value) + val repeatMode = if (value) { PlaybackStateCompat.REPEAT_MODE_ONE - else + } else { PlaybackStateCompat.REPEAT_MODE_NONE + } mediaController.transportControls.setRepeatMode(repeatMode) } diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index f7e85e3..8942c04 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -1,5 +1,4 @@ - -