Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BROWSERTACK-GITHUB-ACTION] Create Android tests github action #2028

Closed
wants to merge 6 commits into from
Closed
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
30 changes: 30 additions & 0 deletions .github/workflows/android-tests.yml
Original file line number Diff line number Diff line change
@@ -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

4 changes: 4 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pipeline {
}
}
stage('Unit tests') {
when { expression { false } }
steps {
script {
echo 'Running unit tests'
Expand All @@ -30,6 +31,7 @@ pipeline {
}
}
stage('Instrumented tests') {
when { expression { false } }
environment {
BROWSERSTACK = credentials('android-browserstack')
}
Expand All @@ -42,6 +44,7 @@ pipeline {
}
}
stage('JaCoCo report') {
when { expression { false } }
steps {
script {
echo 'JaCoCo report'
Expand All @@ -50,6 +53,7 @@ pipeline {
}
}
stage('Sonarqube') {
when { expression { false } }
environment {
GIT_BRANCH = "${env.GIT_BRANCH}"
// Jenkinsfile considers empty value ('') as null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions scripts/browserstackJenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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..."
Expand Down
2 changes: 1 addition & 1 deletion scripts/config_jenkins.init
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading