-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA] Run E2E performance tests imperatively #15608
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
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
221de93
Create composite action to build test APK
roryabraham 988dcfe
Create composite action to build test APK
roryabraham 8be2ec4
Create callable workflow to run E2E performance tests
roryabraham 4078b50
Use callable workflow in preDeploy.yml
roryabraham 2382a47
Add ref for callable workflow
roryabraham 7cc7b65
Don't rebuild baseline apk if it already exists
roryabraham 4512136
Remove TODO
roryabraham eca2910
Add expression brackets around if statements
roryabraham 1a1ce51
Only run E2E tests if PR is triggering a deploy
roryabraham 2ec65cd
Rely solely on PR_NUMBER and use the merge_commit_sha of the PR as th…
roryabraham c7a8d3a
Skip linting of e2e performance tests due to bug in schemastore
roryabraham 14f9cfd
Fix description of prepare job
roryabraham File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| 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@eae47962baca661befdfd24e4d6c34ade04858f7 | ||
| with: | ||
| ruby-version: '2.7' | ||
| bundler-cache: true | ||
|
|
||
| - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef | ||
|
|
||
| - name: Build APK | ||
| run: npm run android-build-e2e | ||
| shell: bash | ||
|
|
||
| - name: Upload APK | ||
| uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 | ||
| with: | ||
| name: ${{ inputs.ARTIFACT_NAME }} | ||
| path: android/app/build/outputs/apk/e2eRelease/app-e2eRelease.apk |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,173 @@ | ||
| name: E2E Performance Tests | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| PR_NUMBER: | ||
| description: A PR to run performance tests against. If already merged, the merge commit will be used. If not, the test merge commit will be used. | ||
| type: string | ||
| required: true | ||
|
|
||
| workflow_dispatch: | ||
| inputs: | ||
| PR_NUMBER: | ||
| description: A PR to run performance tests against. If already merged, the merge commit will be used. If not, the test merge commit will be used. | ||
| type: string | ||
| required: true | ||
|
|
||
| jobs: | ||
| prepare: | ||
| runs-on: ubuntu-latest | ||
| name: Prepare to run builds | ||
| outputs: | ||
| VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} | ||
| DELTA_REF: ${{ steps.getMergeCommitSha.outputs.MERGE_COMMIT_SHA }} | ||
| steps: | ||
| - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
|
|
||
| - name: Get most recent release version | ||
| id: getMostRecentRelease | ||
| run: echo "VERSION=$(gh release list --limit 1 | awk '{ print $1 }')" >> "$GITHUB_OUTPUT" | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
|
|
||
| - name: Get pull request details | ||
| id: getPullRequestDetails | ||
| uses: Expensify/App/.github/actions/javascript/getPullRequestDetails@main | ||
| with: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| PULL_REQUEST_NUMBER: ${{ inputs.PR_NUMBER }} | ||
| user: ${{ github.actor }} | ||
|
|
||
| - name: Get merge commit sha for the pull request | ||
| id: getMergeCommitSha | ||
| run: echo "MERGE_COMMIT_SHA=${{ steps.getPullRequestDetails.outputs.MERGE_COMMIT_SHA }}" >> "$GITHUB_OUTPUT" | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
|
|
||
| buildBaseline: | ||
| runs-on: ubuntu-20.04-64core | ||
| needs: [prepare] | ||
| name: Build apk from latest release as a baseline | ||
| steps: | ||
| - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check if there's an existing artifact for this baseline | ||
| id: checkForExistingArtifact | ||
| uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a | ||
| with: | ||
| name: baseline-apk-${{ needs.prepare.outputs.VERSION }} | ||
|
|
||
| - name: Skip build if there's already an existing artifact for the baseline | ||
| if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.exists) }} | ||
| run: echo 'APK for baseline ${{ needs.prepare.outputs.VERSION }} already exists, reusing existing build' | ||
|
|
||
| - name: Checkout "Baseline" commit (last release) | ||
| if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} | ||
| run: git checkout ${{ needs.prepare.outputs.VERSION }} | ||
|
|
||
| - name: Build APK | ||
| if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} | ||
| uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main | ||
| with: | ||
| ARTIFACT_NAME: baseline-apk-${{ needs.prepare.outputs.VERSION }} | ||
|
|
||
| buildDelta: | ||
| runs-on: ubuntu-20.04-64core | ||
| needs: [prepare] | ||
| name: Build apk from delta ref | ||
| steps: | ||
| - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Checkout "delta ref" | ||
| run: git checkout ${{ needs.prepare.outputs.DELTA_REF }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
|
|
||
| - name: Build APK | ||
| uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main | ||
| with: | ||
| ARTIFACT_NAME: delta-apk-${{ needs.prepare.outputs.DELTA_REF }} | ||
|
|
||
| runTestsInAWS: | ||
| runs-on: ubuntu-20.04-64core | ||
| needs: [prepare, buildBaseline, buildDelta] | ||
| name: Run E2E tests in AWS device farm | ||
| steps: | ||
| - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | ||
| with: | ||
| ref: ${{ needs.prepare.outputs.DELTA_REF }} | ||
|
|
||
| - name: Make zip directory for everything to send to AWS Device Farm | ||
| run: mkdir zip | ||
|
|
||
| - name: Download baseline APK | ||
| uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b | ||
| with: | ||
| name: baseline-apk-${{ needs.prepare.outputs.VERSION }} | ||
| path: zip | ||
|
|
||
| - name: Download delta APK | ||
| uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b | ||
| with: | ||
| name: delta-apk-${{ needs.prepare.outputs.DELTA_REF }} | ||
| path: zip | ||
|
|
||
| - name: Copy e2e code into zip folder | ||
| run: cp -r tests/e2e zip | ||
|
|
||
| - name: Zip everything in the zip directory up | ||
| run: zip -qr App.zip ./zip | ||
|
|
||
| - name: Configure AWS Credentials | ||
| uses: Expensify/App/.github/actions/composite/configureAwsCredentials@main | ||
| 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: Schedule AWS Device Farm test run | ||
| 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-baseline.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/TestSpec.yml | ||
| test_spec_type: APPIUM_NODE_TEST_SPEC | ||
| remote_src: false | ||
| file_artifacts: CustomerArtifacts.zip | ||
| cleanup: true | ||
|
|
||
| - name: Unzip AWS Device Farm results | ||
| if: ${{ always() }} | ||
| run: unzip CustomerArtifacts.zip | ||
|
|
||
| - name: Print AWS Device Farm run results | ||
| if: ${{ always() }} | ||
| run: cat "./Host_Machine_Files/\$WORKING_DIRECTORY/output.md" | ||
|
|
||
| - name: Print AWS Device Farm verbose run results | ||
| if: ${{ always() && fromJSON(runner.debug) }} | ||
| run: cat "./Host_Machine_Files/\$WORKING_DIRECTORY/debug.log" | ||
|
|
||
| - name: Check if test failed, if so post the results and add the DeployBlocker label | ||
| if: ${{ github.event_name == 'workflow_call' }} | ||
| run: | | ||
| if grep -q '🔴' ./Host_Machine_Files/\$WORKING_DIRECTORY/output.md; then | ||
| gh pr edit ${{ inputs.PR_NUMBER }} --add-label DeployBlockerCash | ||
| gh pr comment ${{ inputs.PR_NUMBER }} -F ./Host_Machine_Files/\$WORKING_DIRECTORY/output.md | ||
| gh pr comment ${{ inputs.PR_NUMBER }} -b "@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker." | ||
| else | ||
| echo '✅ no performance regression detected' | ||
| fi | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.