Skip to content

Commit 968f940

Browse files
authored
Update DeviceFarm build config (#2168)
1 parent 3b5ac61 commit 968f940

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

.github/workflows/maven_release_publisher.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ jobs:
2020
with:
2121
project-name: AmplifyAndroid-IntegrationTest
2222
env-vars-for-codebuild: |
23-
ORG_GRADLE_PROJECT_useAwsSdkReleaseBuild
23+
ORG_GRADLE_PROJECT_useAwsSdkReleaseBuild,
24+
NUMBER_OF_DEVICES_TO_TEST
2425
env:
2526
ORG_GRADLE_PROJECT_useAwsSdkReleaseBuild: true
27+
NUMBER_OF_DEVICES_TO_TEST: 3
2628
- name: Configure AWS Credentials
2729
uses: aws-actions/configure-aws-credentials@v1
2830
with:

configuration/instrumentation-tests.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ subprojects {
2525
}
2626
}
2727
}
28-
task runTestsInDeviceFarmPool {
28+
task runNightlyTestsInDeviceFarmPool {
2929
dependsOn(assembleAndroidTest)
3030
doLast {
3131
exec {
32-
commandLine("$rootDir.path/scripts/run_tests_in_devicefarm_pool.sh")
32+
commandLine("$rootDir.path/scripts/run_nightly_tests_in_devicefarm_pool.sh")
3333
args([project.name])
3434
}
3535
}

scripts/run_test_in_devicefarm.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/bin/bash
22
project_arn=$DEVICEFARM_PROJECT_ARN
3+
max_devices=$NUMBER_OF_DEVICES_TO_TEST
34
module_name=$1
45
file_name="$module_name-debug-androidTest.apk"
56
full_path="$module_name/build/outputs/apk/androidTest/debug/$file_name"
@@ -9,6 +10,11 @@ if [[ -z "${project_arn}" ]]; then
910
exit 1
1011
fi
1112

13+
if [[ -z "${max_devices}" ]]; then
14+
echo "NUMBER_OF_DEVICES_TO_TEST not set. Defaulting to 1."
15+
max_devices=1
16+
fi
17+
1218
# Function to setup the app uploads in device farm
1319
function createUpload {
1420
test_type=$1
@@ -110,7 +116,7 @@ run_arn=`aws devicefarm schedule-run --project-arn=$project_arn \
110116
"filters": [
111117
{"attribute": "ARN", "operator":"IN", "values":["'$minDevice'", "'$middleDevice'", "'$latestDevice'"]}
112118
],
113-
"maxDevices": 3
119+
"maxDevices": '$max_devices'
114120
}' \
115121
--name="$file_name-$CODEBUILD_SOURCE_VERSION" \
116122
--test="type=INSTRUMENTATION,testPackageArn=$test_package_upload_arn" \

0 commit comments

Comments
 (0)