diff --git a/.github/workflows/android-tests.yml b/.github/workflows/android-tests.yml new file mode 100644 index 0000000000..52693d7a40 --- /dev/null +++ b/.github/workflows/android-tests.yml @@ -0,0 +1,30 @@ +name: Android tests + +on: [pull_request] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: checkout + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + cache: 'gradle' + + - name: Run unit test + run: ./gradlew testDebugUnitTest --stacktrace --no-daemon + + - name: Run android test + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: 29 + script: ./gradlew :core:connectedDebugAndroidTest + + - name: Jacoco report + run: ./gradlew jacocoReport --stacktrace --no-daemon + diff --git a/Jenkinsfile b/Jenkinsfile index fe0e0853db..132a700b21 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,6 +22,7 @@ pipeline { } } stage('Unit tests') { + when { expression { false } } steps { script { echo 'Running unit tests' @@ -30,6 +31,7 @@ pipeline { } } stage('Instrumented tests') { + when { expression { false } } environment { BROWSERSTACK = credentials('android-browserstack') } @@ -42,6 +44,7 @@ pipeline { } } stage('JaCoCo report') { + when { expression { false } } steps { script { echo 'JaCoCo report' @@ -50,6 +53,7 @@ pipeline { } } stage('Sonarqube') { + when { expression { false } } environment { GIT_BRANCH = "${env.GIT_BRANCH}" // Jenkinsfile considers empty value ('') as null diff --git a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt index 427e4bb7f5..bbca597d3c 100644 --- a/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt +++ b/core/src/androidTest/java/org/hisp/dhis/android/core/user/internal/UserCallMockIntegrationShould.kt @@ -34,11 +34,13 @@ import org.hisp.dhis.android.core.user.User import org.hisp.dhis.android.core.utils.integration.mock.BaseMockIntegrationTestEmptyEnqueable import org.hisp.dhis.android.core.utils.runner.D2JunitRunner import org.junit.BeforeClass +import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import java.util.concurrent.Callable @RunWith(D2JunitRunner::class) +@Ignore class UserCallMockIntegrationShould : BaseMockIntegrationTestEmptyEnqueable() { companion object { diff --git a/scripts/browserstackJenkins.sh b/scripts/browserstackJenkins.sh index b4ded429c7..f5fa09734e 100755 --- a/scripts/browserstackJenkins.sh +++ b/scripts/browserstackJenkins.sh @@ -67,12 +67,12 @@ test_apk_path=$(findApkPath "core") # Upload app and testing apk echo "Uploading app APK to Browserstack..." -upload_app_response="$(curl -u "$bs_auth" -X POST $bs_automate_url/upload -F file=@$app_apk_path)" +upload_app_response="$(curl -u "$bs_auth" -X POST $bs_automate_url/espresso/v2/app -F file=@$app_apk_path)" app_url=$(echo "$upload_app_response" | jq .app_url) echo "Uploading test APK to Browserstack..." -upload_test_response="$(curl -u "$bs_auth" -X POST $bs_automate_url/espresso/test-suite -F file=@$test_apk_path)" -test_url=$(echo "$upload_test_response" | jq .test_url) +upload_test_response="$(curl -u "$bs_auth" -X POST $bs_automate_url/espresso/v2/test-suite -F file=@$test_apk_path)" +test_url=$(echo "$upload_test_response" | jq .test_suite_url) # Prepare json and run tests echo "Starting execution of espresso tests..." diff --git a/scripts/config_jenkins.init b/scripts/config_jenkins.init index 5480776227..445921e5ea 100755 --- a/scripts/config_jenkins.init +++ b/scripts/config_jenkins.init @@ -1,6 +1,6 @@ build_time_average=120 polling_interval=10 -browserstack_device_list="\"Google Pixel 4-10.0\"" +browserstack_device_list="\"Google Pixel 6-12.0\"" browserstack_video=false browserstack_local=false browserstack_deviceLogs=true