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

[NoQA] Staggered approach to E2E tests #30793

Merged
merged 30 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b712a76
Try building two different app versions
ospfranco Nov 2, 2023
d1cedad
Add delta config to e2e
ospfranco Nov 2, 2023
e63fa4e
Different google-services
ospfranco Nov 2, 2023
7a9cfd7
Skip checkout for now
ospfranco Nov 2, 2023
6b0a85e
add e2e delta signing config
ospfranco Nov 2, 2023
1196a69
Fix local path
ospfranco Nov 2, 2023
ca32109
Mess with environment files
ospfranco Nov 2, 2023
1e70418
Add e2edelta android manifest to allow clear text traffic
ospfranco Nov 2, 2023
49ab629
Adjust results object to take branch name
ospfranco Nov 2, 2023
ac954aa
Finish main script
ospfranco Nov 2, 2023
ec6d8ed
Modify github action
ospfranco Nov 2, 2023
1f28c56
Point to single TestSpec AWS DF file
ospfranco Nov 2, 2023
4e20258
Undo changes to server
ospfranco Nov 2, 2023
5c1d338
Re-add js-only bundle generation
ospfranco Nov 2, 2023
f3ee19e
Update path of generated APK
ospfranco Nov 6, 2023
1f65cf4
Fix name of APK on aws step
ospfranco Nov 7, 2023
1e430e7
Merge branch 'main' into osp/e2e-staggered
ospfranco Nov 7, 2023
7ea652d
Merge branch 'main' into osp/e2e-staggered
ospfranco Nov 8, 2023
f226f32
Fix test runner
ospfranco Nov 8, 2023
fc3e333
Build release version inline instead of using actions and try to unin…
ospfranco Nov 8, 2023
84c4551
Update documetnation
ospfranco Nov 8, 2023
667eaef
Skip switching branches during testing
ospfranco Nov 8, 2023
135c09f
Revert uninstalling old app
ospfranco Nov 8, 2023
2786049
Merge branch 'main' into osp/e2e-staggered
ospfranco Nov 8, 2023
bdf9bac
Add custom setup script
ospfranco Nov 8, 2023
bbfb713
Add custom setup script ruby and gradle build part
ospfranco Nov 8, 2023
687c108
Fix generated artifact path
ospfranco Nov 8, 2023
070c173
unzip and print correct results
ospfranco Nov 8, 2023
9c77c78
Bring back checks for already built artifacts
ospfranco Nov 9, 2023
c2f29a8
Add branch to typing test
ospfranco Nov 9, 2023
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
29 changes: 29 additions & 0 deletions .github/actions/composite/buildAndroidAPKDelta/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build an Android apk
description: Build an Android apk for an E2E test build and upload it as an artifact

inputs:
ARTIFACT_NAME:
description: The name of the workflow artifact where the APK should be uploaded
required: true

runs:
using: composite
steps:
- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
with:
ruby-version: "2.7"
bundler-cache: true

- uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef

- name: Build APK
run: npm run android-build-e2edelta
shell: bash

- name: Upload APK
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
name: ${{ inputs.ARTIFACT_NAME }}
path: android/app/build/outputs/apk/e2e/release/app-e2edelta-release.apk
83 changes: 43 additions & 40 deletions .github/workflows/e2ePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,28 @@ jobs:
git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1
git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }}

- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
with:
ruby-version: "2.7"
bundler-cache: true

- uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef

- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- name: Build APK
if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }}
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
run: npm run android-build-e2e
shell: bash

- name: Upload APK
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }}
name: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }}
path: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk


buildDelta:
runs-on: ubuntu-latest-xl
Expand Down Expand Up @@ -113,10 +127,24 @@ jobs:
- name: Configure MapBox SDK
run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

- uses: Expensify/App/.github/actions/composite/setupNode@main

- uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011
with:
ruby-version: "2.7"
bundler-cache: true

- uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef

- name: Build APK
uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main
run: npm run android-build-e2edelta
shell: bash

- name: Upload APK
uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05
with:
ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }}
name: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }}
path: android/app/build/outputs/apk/e2edelta/release/app-e2edelta-release.apk

runTestsInAWS:
runs-on: ubuntu-latest
Expand All @@ -140,7 +168,7 @@ jobs:

# The downloaded artifact will be a file named "app-e2e-release.apk" so we have to rename it
- name: Rename baseline APK
run: mv "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2e-release.apk" "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease-main.apk"
run: mv "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2e-release.apk" "${{steps.downloadBaselineAPK.outputs.download-path}}/app-e2eRelease.apk"

- name: Download delta APK
uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b
Expand All @@ -150,7 +178,7 @@ jobs:
path: zip

- name: Rename delta APK
run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2e-release.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2eRelease-delta.apk"
run: mv "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2edelta-release.apk" "${{steps.downloadDeltaAPK.outputs.download-path}}/app-e2edeltaRelease.apk"

- name: Copy e2e code into zip folder
run: cp -r tests/e2e zip
Expand All @@ -172,12 +200,12 @@ jobs:
name: App E2E Performance Regression Tests
project_arn: ${{ secrets.AWS_PROJECT_ARN }}
device_pool_arn: ${{ secrets.AWS_DEVICE_POOL_ARN }}
app_file: zip/app-e2eRelease-main.apk
app_file: zip/app-e2eRelease.apk
app_type: ANDROID_APP
test_type: APPIUM_NODE
test_package_file: App.zip
test_package_type: APPIUM_NODE_TEST_PACKAGE
test_spec_file: tests/e2e/TestSpecMain.yml
test_spec_file: tests/e2e/TestSpec.yml
test_spec_type: APPIUM_NODE_TEST_SPEC
remote_src: false
file_artifacts: Customer Artifacts.zip
Expand All @@ -192,38 +220,13 @@ jobs:
unzip "Customer Artifacts.zip" -d mainResults
cat ./mainResults/Host_Machine_Files/\$WORKING_DIRECTORY/debug.log

- name: Unzip AWS Device Farm main results
run: unzip "Customer Artifacts.zip" -d mainResults

- name: Delete Customer Artifacts.zip
run: rm "Customer Artifacts.zip"

- name: Schedule AWS Device Farm test run on delta branch
uses: realm/aws-devicefarm/test-application@7b9a91236c456c97e28d384c9e476035d5ea686b
with:
name: App E2E Performance Regression Tests
project_arn: ${{ secrets.AWS_PROJECT_ARN }}
device_pool_arn: ${{ secrets.AWS_DEVICE_POOL_ARN }}
app_file: zip/app-e2eRelease-delta.apk
app_type: ANDROID_APP
test_type: APPIUM_NODE
test_package_file: App.zip
test_package_type: APPIUM_NODE_TEST_PACKAGE
test_spec_file: tests/e2e/TestSpecDelta.yml
test_spec_type: APPIUM_NODE_TEST_SPEC
remote_src: false
file_artifacts: Customer Artifacts.zip
cleanup: true
timeout: 5400

- name: Unzip AWS Device Farm delta results
run: unzip "Customer Artifacts.zip" -d deltaResults

- name: Compare results
run: node tests/e2e/merge.js --mainPath ./mainResults/Host_Machine_Files/\$WORKING_DIRECTORY/main.json --deltaPath ./deltaResults//Host_Machine_Files/\$WORKING_DIRECTORY/delta.json --outputPath ./output.md
- name: Unzip AWS Device Farm results
if: ${{ always() }}
run: unzip "Customer Artifacts.zip"

- name: Print results
run: cat "./output.md"
- name: Print AWS Device Farm run results
if: ${{ always() }}
run: cat "./Host_Machine_Files/\$WORKING_DIRECTORY/output.md"

- name: Check if test failed, if so post the results and add the DeployBlocker label
run: |
Expand Down
15 changes: 12 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ project.ext.envConfigFiles = [
adhocRelease: ".env.adhoc",
developmentRelease: ".env",
developmentDebug: ".env",
e2eRelease: "tests/e2e/.env.e2e"
e2eRelease: "tests/e2e/.env.e2e",
e2edeltaRelease: "tests/e2e/.env.e2edelta"
]

/**
Expand Down Expand Up @@ -101,7 +102,14 @@ android {
e2e {
// If are building a version that won't be uploaded to the play store, we don't have to use production keys
// applies all non-production flavors
applicationIdSuffix ".adhoc"
applicationIdSuffix ".e2e"
signingConfig signingConfigs.debug
resValue "string", "build_config_package", "com.expensify.chat"
}
e2edelta {
// If are building a version that won't be uploaded to the play store, we don't have to use production keys
// applies all non-production flavors
applicationIdSuffix ".e2edelta"
signingConfig signingConfigs.debug
resValue "string", "build_config_package", "com.expensify.chat"
}
Expand Down Expand Up @@ -150,12 +158,13 @@ android {
}
// ... except for the e2e flavor, which we maybe want to build locally:
productFlavors.e2e.signingConfig signingConfigs.debug
productFlavors.e2edelta.signingConfig signingConfigs.debug
}
}

// since we don't need variants adhocDebug and e2eDebug, we can force gradle to ignore them
variantFilter { variant ->
if (variant.name == "adhocDebug" || variant.name == "e2eDebug") {
if (variant.name == "adhocDebug" || variant.name == "e2eDebug" || variant.name == "e2edeltaDebug") {
setIgnore(true)
}
}
Expand Down
Loading
Loading