From 60175b9cd2fe3d0ce586e95042a5503feed105e2 Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:43:25 -0300 Subject: [PATCH 1/7] update --- app/build.gradle | 10 +++++++++- .../home/presentation/HomeViewModelTest.kt | 19 +++++++++++++++++++ build.gradle | 2 ++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 app/src/main/kotlin/com/luishenrique/cutecatsgallery/home/presentation/HomeViewModelTest.kt diff --git a/app/build.gradle b/app/build.gradle index fdfa34a..ea0e3ae 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,6 +61,8 @@ dependencies { implementation "androidx.compose.material:material-android:1.5.3" implementation "io.coil-kt:coil-compose:2.4.0" implementation "androidx.navigation:navigation-compose:2.7.4" + testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' + testImplementation 'org.junit.jupiter:junit-jupiter:5.8.1' debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version" androidTestImplementation platform("androidx.compose:compose-bom:2023.10.00") @@ -83,10 +85,16 @@ dependencies { // viewModel implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2" + // Testng + implementation "org.testng:testng:$testng_version" + + // Mockk + testImplementation "io.mockk:mockk:$mockk_version" + implementation "androidx.core:core-ktx:1.12.0" implementation "com.google.android.material:material:1.10.0" implementation "androidx.appcompat:appcompat:1.6.1" - testImplementation "junit:junit:4.13.2" + testImplementation "junit:junit:*" androidTestImplementation "androidx.test.ext:junit:1.1.5" androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1" } \ No newline at end of file diff --git a/app/src/main/kotlin/com/luishenrique/cutecatsgallery/home/presentation/HomeViewModelTest.kt b/app/src/main/kotlin/com/luishenrique/cutecatsgallery/home/presentation/HomeViewModelTest.kt new file mode 100644 index 0000000..fab9ea4 --- /dev/null +++ b/app/src/main/kotlin/com/luishenrique/cutecatsgallery/home/presentation/HomeViewModelTest.kt @@ -0,0 +1,19 @@ +package com.luishenrique.cutecatsgallery.home.presentation + +import org.junit.Before +import org.junit.Test + +class HomeViewModelTest { + +// private lateinit var viewModel: HomeViewModel + + @Before + fun before() { +// viewModel = null + } + +// @Test +// fun `given getCats method when call it then cancel job`() { +//// viewModel.getCats() +// } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 655b133..648273f 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,8 @@ buildscript { klint_version = "9.2.1" compose_version = "1.5.3" compose_compiler_version = "1.4.3" + mockk_version = "1.13.8" + testng_version = "7.3.0" } repositories { google() From f6e88245a4f2e3d68fd042c3932e27c73038b1dd Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:51:17 -0300 Subject: [PATCH 2/7] ci: updated --- .github/workflows/ci_pipeline.yml | 35 +++++++++++++++++-------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 8052bb3..27bcb00 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -1,37 +1,40 @@ name: cute-cat-gallery-ci-pipeline on: pull_request: - branches: [main, develop] + branches: [ main, develop ] push: - branches: [main, develop] + branches: [ main, develop ] jobs: build: runs-on: ubuntu-latest steps: + - name: Checkout uses: actions/checkout@v4.1.0 + - name: Setup Java JDK uses: actions/setup-java@v3.13.0 with: java-version: '17' distribution: 'adopt' - - name: Make gradlew executable - run: chmod +x ./gradlew - - name: Gradle Build Action - uses: gradle/gradle-build-action@v2.9.0 - with: - arguments: build - gradle-version: 7.6 - - name: Run KLint + + - name: Setup Gradle uses: gradle/gradle-build-action@v2.9.0 with: - arguments: ktlintCheck - gradle-version: 7.6 + gradle-version: 8.1 + + - name: Make gradlew executable + run: chmod +x ./gradlew + + - name: Build + run: ./gradlew :app:assembleDebug + + - name: Run Lint + run: ./gradlew ktlintCheck + - name: Run Tests - uses: gradle/gradle-build-action@v2.9.0 - with: - arguments: test - gradle-version: 7.6 + run: ./gradlew testDebugUnitTest + - name: Upload a Build Artifact uses: actions/upload-artifact@v3.1.3 with: From b283ad41debf4326e3206d2203508445a6d4c205 Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:52:42 -0300 Subject: [PATCH 3/7] ci: updated --- .github/workflows/ci_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 27bcb00..541ae13 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -21,7 +21,7 @@ jobs: - name: Setup Gradle uses: gradle/gradle-build-action@v2.9.0 with: - gradle-version: 8.1 + gradle-version: 8.1.1 - name: Make gradlew executable run: chmod +x ./gradlew From 4991f0162fa7ae0e9d76193fd535d59944a315fb Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 12:53:51 -0300 Subject: [PATCH 4/7] ci: updated --- .github/workflows/ci_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_pipeline.yml b/.github/workflows/ci_pipeline.yml index 541ae13..fdda620 100644 --- a/.github/workflows/ci_pipeline.yml +++ b/.github/workflows/ci_pipeline.yml @@ -27,7 +27,7 @@ jobs: run: chmod +x ./gradlew - name: Build - run: ./gradlew :app:assembleDebug + run: ./gradlew assembleDebug - name: Run Lint run: ./gradlew ktlintCheck From 09387e60f61dabc3a0267b9318686add9bf2c010 Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:05:34 -0300 Subject: [PATCH 5/7] ci: updated --- app/build.gradle | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index ea0e3ae..dbdc9d7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,9 @@ plugins { android { compileSdk 34 - + packagingOptions { + exclude 'META-INF/INDEX.LIST' + } defaultConfig { applicationId "com.luishenrique.cutecatsgallery" minSdkVersion 21 @@ -70,6 +72,8 @@ dependencies { implementation 'com.google.accompanist:accompanist-swiperefresh:0.32.0' + implementation 'com.google.guava:guava:27.0.1-android' + // progressbar cat implementation "com.roger.catloadinglibrary:catloadinglibrary:1.0.9" From e611fc169a42762793f0d98b35673174b77c9256 Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:08:39 -0300 Subject: [PATCH 6/7] ci: updated --- gradlew | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gradlew b/gradlew index 65dcd68..aeb74cb 100644 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in From 721ce6e00612f9c5880f0fed61dc78f22881b493 Mon Sep 17 00:00:00 2001 From: Luis Henrique <65178969+Louiixx-h@users.noreply.github.com> Date: Wed, 1 Nov 2023 13:11:42 -0300 Subject: [PATCH 7/7] ci: updated --- .gitignore | 3 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 276b709..eb75477 100644 --- a/.gitignore +++ b/.gitignore @@ -180,8 +180,7 @@ crashlytics-build.properties fabric.properties ### AndroidStudio Patch ### - -!/gradle/wrapper/gradle-wrapper.jar +!gradle/wrapper/gradle-wrapper.jar ### Intellij ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c85a1f..37aef8d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists