feat: add integration test #1
Workflow file for this run
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: Integration Test | |
on: | |
push: | |
branches: [ "*" ] | |
pull_request: | |
branches: [ "*" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
iam_role_to_assume: ${{ secrets.ROLE_ARN }} | |
device_farm_project_arn: ${{ secrets.DEVICE_FARM_PROJECT_ARN }} | |
device_farm_pool_arn: ${{ secrets.DEVICE_FARM_POOL_ARN }} | |
device_farm_test_spec_arn: ${{ secrets.DEVICE_FARM_TEST_SPEC_ARN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'corretto' | |
cache: gradle | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Configure AWS Credentials | |
if: ${{ env.iam_role_to_assume != '' }} | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ env.iam_role_to_assume }} | |
aws-region: us-west-2 | |
- name: Build release aar | |
run: ./gradlew assembleRelease | |
- name: Build apk | |
run: | | |
git clone https://github.com/zhu-xiaowei/shopping-android | |
cd shopping-android | |
./gradlew assembleDebug | |
cd .. | |
- name: Build device farm test file | |
run: | | |
cd integrationtest | |
virtualenv workspace | |
cd workspace | |
source bin/activate | |
pip install pytest | |
pip install Appium-Python-Client | |
mkdir tests | |
cp ../appium/shopping_test.py tests/ | |
find tests/ | |
py.test --collect-only tests/ | |
find . -name '__pycache__' -type d -exec rm -r {} + | |
find . -name '*.pyc' -exec rm -f {} + | |
find . -name '*.pyo' -exec rm -f {} + | |
find . -name '*~' -exec rm -f {} + | |
pip freeze > requirements.txt | |
zip -r test_bundle.zip tests/ requirements.txt | |
cd .. | |
- name: Execute device farm test | |
run: | | |
pip install -r requirements.txt | |
cd devicefarm | |
cp ../../shopping-android/app/build/output/apk/debug/app-debug.apk ./ | |
cp ../workspace/test_bundle.zip ./ | |
ls | |
python -c "from automate_device_farm import upload_and_test_android; upload_and_test_android('app-debug.apk', 'test_bundle.zip', '${{ env.device_farm_project_arn }}', '${{ env.device_farm_test_spec_arn }}', '${{ env.device_farm_pool_arn }}')" |