Skip to content

chore(all): Update DeviceFarm build config #2168

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

Merged
merged 2 commits into from
Dec 9, 2022
Merged
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
4 changes: 3 additions & 1 deletion .github/workflows/maven_release_publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ jobs:
with:
project-name: AmplifyAndroid-IntegrationTest
env-vars-for-codebuild: |
ORG_GRADLE_PROJECT_useAwsSdkReleaseBuild
ORG_GRADLE_PROJECT_useAwsSdkReleaseBuild,
NUMBER_OF_DEVICES_TO_TEST
env:
ORG_GRADLE_PROJECT_useAwsSdkReleaseBuild: true
NUMBER_OF_DEVICES_TO_TEST: 3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
4 changes: 2 additions & 2 deletions configuration/instrumentation-tests.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ subprojects {
}
}
}
task runTestsInDeviceFarmPool {
task runNightlyTestsInDeviceFarmPool {
dependsOn(assembleAndroidTest)
doLast {
exec {
commandLine("$rootDir.path/scripts/run_tests_in_devicefarm_pool.sh")
commandLine("$rootDir.path/scripts/run_nightly_tests_in_devicefarm_pool.sh")
args([project.name])
}
}
Expand Down
8 changes: 7 additions & 1 deletion scripts/run_test_in_devicefarm.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
project_arn=$DEVICEFARM_PROJECT_ARN
max_devices=$NUMBER_OF_DEVICES_TO_TEST
module_name=$1
file_name="$module_name-debug-androidTest.apk"
full_path="$module_name/build/outputs/apk/androidTest/debug/$file_name"
Expand All @@ -9,6 +10,11 @@ if [[ -z "${project_arn}" ]]; then
exit 1
fi

if [[ -z "${max_devices}" ]]; then
echo "NUMBER_OF_DEVICES_TO_TEST not set. Defaulting to 1."
max_devices=1
fi

# Function to setup the app uploads in device farm
function createUpload {
test_type=$1
Expand Down Expand Up @@ -110,7 +116,7 @@ run_arn=`aws devicefarm schedule-run --project-arn=$project_arn \
"filters": [
{"attribute": "ARN", "operator":"IN", "values":["'$minDevice'", "'$middleDevice'", "'$latestDevice'"]}
],
"maxDevices": 3
"maxDevices": '$max_devices'
}' \
--name="$file_name-$CODEBUILD_SOURCE_VERSION" \
--test="type=INSTRUMENTATION,testPackageArn=$test_package_upload_arn" \
Expand Down