UITest #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: UITest | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
device: | ||
required: true | ||
default: 'Pixel8_API33' | ||
type: choice | ||
options: | ||
- 'Pixel8_API33' | ||
- 'Pixel8_API35' | ||
runner: | ||
required: true | ||
default: 'autotestdebug' | ||
type: choice | ||
options: | ||
- 'autotestdebug' | ||
- 'ubuntu-latest' | ||
jobs: | ||
build: | ||
name: build android application for ui tests | ||
runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }} | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Print Env Variables | ||
run: env | ||
working-directory: ${{ github.workspace }} | ||
- name: checkout source code of application | ||
uses: actions/checkout@v4 | ||
with: | ||
clean: true | ||
path: 'appodeal-android-sdk' | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Build with Gradle | ||
working-directory: ${{ github.workspace }}/appodeal-android-sdk | ||
run: ./gradlew :banner:assembleDebug | ||
- name: save debug build for aws | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: banner-debug.apk | ||
path: appodeal-android-sdk/banner/build/outputs/apk/debug/banner-debug.apk | ||
retention-days: 14 | ||
tests: | ||
name: run ui tests on aws with appium | ||
needs: build | ||
runs-on: ${{ github.event.inputs.runner || 'autotestdebug' }} | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Print Env Variables | ||
run: env | ||
working-directory: ${{ github.workspace }} | ||
- name: checkout source code of application | ||
uses: actions/checkout@v4 | ||
with: | ||
path: 'SDK-Auto-Test' | ||
clean: true | ||
repository: 'appodeal/SDK-Auto-Test' | ||
ref: 'aws' | ||
token: ${{ secrets.UITESTREPOACCESS }} | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
- name: download debug build | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: banner-debug.apk | ||
path: ./SDK-Auto-Test/apk | ||
- name: prepare build | ||
working-directory: ${{ github.workspace }}/SDK-Auto-Test | ||
run: | | ||
mvn clean | ||
sleep 10 | ||
mvn jar:jar | ||
sleep 10 | ||
mvn jar:test-jar | ||
sleep 10 | ||
mvn assembly:assembly -DskipTests -Ddescriptor=src/main/assembly/zip.xml | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-west-2 | ||
- name: Upload APK to AWS Device Farm | ||
id: upload-apk | ||
run: | | ||
apk_url=$(aws devicefarm create-upload \ | ||
--project-arn ${{ secrets.AWS_PROJECT_ARN }} \ | ||
--name banner-debug.apk \ | ||
--type ANDROID_APP \ | ||
--region us-west-2 \ | ||
--query 'upload.url' \ | ||
--output text) | ||
curl -T ./SDK-Auto-Test/apk/banner-debug.apk "$apk_url" | ||
- name: Upload Test ZIP to AWS Device Farm | ||
id: upload-test-zip | ||
run: | | ||
zip_url=$(aws devicefarm create-upload \ | ||
--project-arn ${{ secrets.AWS_PROJECT_ARN }} \ | ||
--name zip-with-dependencies.zip \ | ||
--type APPIUM_JAVA_TESTNG_TEST_PACKAGE \ | ||
--region us-west-2 \ | ||
--query 'upload.url' \ | ||
--output text) | ||
curl -T ./SDK-Auto-Test/target/zip-with-dependencies.zip "$zip_url" | ||
- name: Get App ARN | ||
id: get-app-arn | ||
run: | | ||
echo "APP_ARN=$(aws devicefarm list-uploads \ | ||
--project-arn ${{ secrets.AWS_PROJECT_ARN }} \ | ||
--type ANDROID_APP \ | ||
--query 'uploads[?name==`banner-debug.apk`].arn' \ | ||
--output text \ | ||
--region us-west-2)" >> $GITHUB_ENV | ||
- name: Get Test Package ARN | ||
id: get-test-package-arn | ||
run: | | ||
echo "TEST_PACKAGE_ARN=$(aws devicefarm list-uploads \ | ||
--project-arn ${{ secrets.AWS_PROJECT_ARN }} \ | ||
--type APPIUM_JAVA_TESTNG_TEST_PACKAGE \ | ||
--query 'uploads[?name==`zip-with-dependencies.zip`].arn' \ | ||
--output text \ | ||
--region us-west-2)" >> $GITHUB_ENV | ||
- name: Get Test Spec ARN | ||
id: get-test-spec-arn | ||
run: | | ||
echo "TEST_SPEC_ARN=$(aws devicefarm list-uploads \ | ||
--project-arn ${{ secrets.AWS_PROJECT_ARN }} \ | ||
--type APPIUM_JAVA_TESTNG_TEST_SPEC \ | ||
--query 'uploads[?name==`default.yml`].arn' \ | ||
--output text \ | ||
--region us-west-2)" >> $GITHUB_ENV | ||
- name: Schedule Device Farm Automated Test | ||
id: run-test | ||
uses: aws-actions/[email protected] | ||
with: | ||
Check failure on line 160 in .github/workflows/uitests.yaml
|
||
run-settings-json: | | ||
{ | ||
"name": "GitHubAction-${{ github.workflow }}_${{ github.run_id }}_${{ github.run_attempt }}", | ||
"projectArn": "${{ secrets.AWS_PROJECT_ARN }}", | ||
"appArn": "${{ env.APP_ARN }}", | ||
"devicePoolArn": "arn:aws:devicefarm:us-west-2:381491970378:devicepool:4c28c1e5-8344-4d34-919c-a1e9377d3b2f/86ebd86a-2150-4997-b71f-2e3d72510e0d", | ||
"test": { | ||
"type": "APPIUM_JAVA_TESTNG_TEST_PACKAGE", | ||
"testPackageArn": "${{ env.TEST_PACKAGE_ARN }}", | ||
"testSpecArn": "${{ env.TEST_SPEC_ARN }}" | ||
} | ||
} | ||
artifact-types: ALL | ||
- name: Adding summary | ||
if: ${{ always()}} | ||
run: | | ||
echo "### Results of test execution :fire:" >> $GITHUB_STEP_SUMMARY | ||
echo "Launch: ${{ github.run_number }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Device: ${{ github.event.inputs.device }}" >> $GITHUB_STEP_SUMMARY | ||
echo "Build agent: ${{ github.event.inputs.runner }}" >> $GITHUB_STEP_SUMMARY |