From 221de93338a017b4cac3a69330ab7d8d97ce88e7 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 17:23:15 -0800 Subject: [PATCH 01/12] Create composite action to build test APK --- .github/actions/composite/buildAndroidAPK/action.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 .github/actions/composite/buildAndroidAPK/action.yml diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml new file mode 100644 index 000000000000..e69de29bb2d1 From 988dcfe4763a3e0976ffb3be333c643b4793ba84 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 17:24:03 -0800 Subject: [PATCH 02/12] Create composite action to build test APK --- .../composite/buildAndroidAPK/action.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index e69de29bb2d1..819234df0bc3 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -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 From 8be2ec48a8b3e21870e8d0e461922ab9313a398f Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 17:24:29 -0800 Subject: [PATCH 03/12] Create callable workflow to run E2E performance tests --- .github/workflows/e2ePerformanceTests.yml | 139 ++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 .github/workflows/e2ePerformanceTests.yml diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml new file mode 100644 index 000000000000..6f651cf9950f --- /dev/null +++ b/.github/workflows/e2ePerformanceTests.yml @@ -0,0 +1,139 @@ +name: E2E Performance Tests + +on: + workflow_call: + inputs: + DELTA_REF: + description: A branch or commit ref to build the test build on + type: string + required: true + PR_NUMBER: + description: The number of a merged PR, if this workflow is being triggered by a PR merge + type: string + required: true + + workflow_dispatch: + inputs: + DELTA_REF: + description: A branch or commit ref to build the test build on + type: string + required: true + +jobs: + # TODO: Actor validation needed? + + buildBaseline: + runs-on: ubuntu-20.04-64core + name: Build apk from latest release as a baseline + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + + # TODO: If the baseline hasn't changed since the last time this job ran, we don't need to re-run the build and can reuse the old artifact + - name: Checkout "Baseline" commit (last release) + run: git checkout "$(gh release list --limit 1 | awk '{ print $1 }')" + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Build APK + uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + with: + ARTIFACT_NAME: baseline-apk-${{ github.run_id }} + + buildDelta: + runs-on: ubuntu-20.04-64core + name: Build apk from delta ref + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + fetch-depth: 0 + + - name: Checkout "delta ref" + run: git checkout ${{ inputs.DELTA_REF }} + env: + GITHUB_TOKEN: ${{ github.token }} + + - name: Build APK + uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main + with: + ARTIFACT_NAME: delta-apk-${{ inputs.DELTA_REF }} + + runTestsInAWS: + runs-on: ubuntu-20.04-64core + needs: [buildBaseline, buildDelta] + name: Run E2E tests in AWS device farm + steps: + - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + with: + ref: ${{ inputs.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-${{ github.run_id }} + path: zip + + - name: Download delta APK + uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b + with: + name: delta-apk-${{ inputs.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 }} From 4078b50a7d9b8e547c5a84219ddbaa6b2630b712 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 17:27:13 -0800 Subject: [PATCH 04/12] Use callable workflow in preDeploy.yml --- .github/workflows/preDeploy.yml | 128 ++------------------------------ 1 file changed, 7 insertions(+), 121 deletions(-) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index af42e68bdabb..dcd90b5a64c7 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -222,124 +222,10 @@ jobs: So it might take a while before you're paid for your work, but we typically post multiple new jobs every day, so there's plenty of opportunity. I hope you've had a positive experience contributing to this repo! :blush: - e2e-tests: - name: "Run e2e performance regression tests" - runs-on: ubuntu-20.04-64core - steps: - - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - with: - fetch-depth: 0 - - - uses: Expensify/App/.github/actions/composite/setupNode@main - - - uses: ruby/setup-ruby@eae47962baca661befdfd24e4d6c34ade04858f7 - with: - ruby-version: '2.7' - bundler-cache: true - - # Cache gradle to improve Android build time - - name: Gradle cache - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef - - - name: Make zip directory for everything to send to AWS Device Farm - run: mkdir zip - - - name: Checkout "Compare" commit - run: git checkout ${{ github.event.before }} - - - name: Install node packages - uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350 - with: - timeout_minutes: 10 - max_attempts: 5 - command: npm ci - - - name: Build "Compare" APK - run: npm run android-build-e2e - - - name: Copy "Compare" APK - run: cp android/app/build/outputs/apk/e2eRelease/app-e2eRelease.apk zip/app-e2eRelease-compare.apk - - - name: Checkout "Baseline" commit (last release) - run: git checkout "$(gh release list --limit 1 | awk '{ print $1 }')" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Install node packages - uses: nick-invision/retry@0711ba3d7808574133d713a0d92d2941be03a350 - with: - timeout_minutes: 10 - max_attempts: 5 - command: npm ci - - - name: Build "Baseline" APK - run: npm run android-build-e2e - - - name: Copy "Baseline" APK - run: cp android/app/build/outputs/apk/e2eRelease/app-e2eRelease.apk zip/app-e2eRelease-baseline.apk - - - name: Checkout previous branch for source code to run on AWS Device farm - run: git checkout - - - - 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: Customer Artifacts.zip - cleanup: true - - - name: Unzip AWS Device Farm results - if: ${{ always() }} - run: unzip Customer\ Artifacts.zip - - - name: Print AWS Device Farm run results - if: ${{ always() }} - run: cat "./Host_Machine_Files/\$WORKING_DIRECTORY/debug.log" - - - name: Set output of AWS Device Farm into GitHub ENV - run: | - { echo 'OUTPUT<> "$GITHUB_ENV" - - - name: Get merged pull request - id: getMergedPullRequest - # TODO: Point back action actions-ecosystem after https://github.com/actions-ecosystem/action-get-merged-pull-request/pull/223 is merged - uses: roryabraham/action-get-merged-pull-request@7a7a194f6ff8f3eef58c822083695a97314ebec1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Leave output of AWS Device Farm as a PR comment - run: | - gh pr comment ${{ steps.getMergedPullRequest.outputs.number }} -F ./Host_Machine_Files/\$WORKING_DIRECTORY/output.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Check if test failed, if so leave a deploy blocker label - if: ${{ contains(env.OUTPUT, '🔴') }} - run: | - gh pr edit ${{ steps.getMergedPullRequest.outputs.number }} --add-label 'DeployBlockerCash' - gh pr comment ${{ steps.getMergedPullRequest.outputs.number }} -b "@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker." - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + e2ePerformanceTests: + needs: [chooseDeployActions] + uses: Expensify/App/.github/workflows/e2ePerformanceTests.yml + secrets: inherit + with: + DELTA_REF: main + PR_NUMBER: ${{ needs.chooseDeployActions.outputs.MERGED_PR }} From 2382a47d7ff8d8482fded1c6c034575ad1701b3d Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 17:36:51 -0800 Subject: [PATCH 05/12] Add ref for callable workflow --- .github/workflows/preDeploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index dcd90b5a64c7..ef417b8c8c31 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -224,7 +224,7 @@ jobs: e2ePerformanceTests: needs: [chooseDeployActions] - uses: Expensify/App/.github/workflows/e2ePerformanceTests.yml + uses: Expensify/App/.github/workflows/e2ePerformanceTests.yml@main secrets: inherit with: DELTA_REF: main From 7cc7b659af2e0c968d9fe4b906316f2e7ba25847 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 18:07:06 -0800 Subject: [PATCH 06/12] Don't rebuild baseline apk if it already exists --- .github/workflows/e2ePerformanceTests.yml | 34 ++++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 6f651cf9950f..39199ecc9cbb 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -21,25 +21,45 @@ on: jobs: # TODO: Actor validation needed? + getMostRecentRelease: + runs-on: ubuntu-latest + name: Get the most recent release version + outputs: + VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} + steps: + - 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 }} buildBaseline: runs-on: ubuntu-20.04-64core + needs: [getMostRecentRelease] name: Build apk from latest release as a baseline steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: fetch-depth: 0 - # TODO: If the baseline hasn't changed since the last time this job ran, we don't need to re-run the build and can reuse the old artifact + - name: Check if there's an existing artifact for this baseline + id: checkForExistingArtifact + uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a + with: + name: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} + + - if: fromJSON(steps.checkForExistingArtifact.outputs.exists) + run: echo 'APK for baseline ${{ needs.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' + - name: Checkout "Baseline" commit (last release) - run: git checkout "$(gh release list --limit 1 | awk '{ print $1 }')" - env: - GITHUB_TOKEN: ${{ github.token }} + if: !fromJSON(steps.checkForExistingArtifact.outputs.exists) + run: git checkout ${{ needs.getMostRecentRelease.outputs.VERSION }} - name: Build APK + if: !fromJSON(steps.checkForExistingArtifact.outputs.exists) uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: - ARTIFACT_NAME: baseline-apk-${{ github.run_id }} + ARTIFACT_NAME: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} buildDelta: runs-on: ubuntu-20.04-64core @@ -61,7 +81,7 @@ jobs: runTestsInAWS: runs-on: ubuntu-20.04-64core - needs: [buildBaseline, buildDelta] + needs: [getMostRecentRelease, buildBaseline, buildDelta] name: Run E2E tests in AWS device farm steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -74,7 +94,7 @@ jobs: - name: Download baseline APK uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b with: - name: baseline-apk-${{ github.run_id }} + name: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} path: zip - name: Download delta APK From 4512136a17062147ce0e38b7029d7769cd903a34 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 1 Mar 2023 18:07:36 -0800 Subject: [PATCH 07/12] Remove TODO --- .github/workflows/e2ePerformanceTests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 39199ecc9cbb..baab6477ede2 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -20,7 +20,6 @@ on: required: true jobs: - # TODO: Actor validation needed? getMostRecentRelease: runs-on: ubuntu-latest name: Get the most recent release version From eca29105329eded90aabed23192941137d069446 Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 2 Mar 2023 09:02:54 -0800 Subject: [PATCH 08/12] Add expression brackets around if statements --- .github/workflows/e2ePerformanceTests.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index baab6477ede2..351891e1203e 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -47,15 +47,16 @@ jobs: with: name: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} - - if: fromJSON(steps.checkForExistingArtifact.outputs.exists) + - 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.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' - name: Checkout "Baseline" commit (last release) - if: !fromJSON(steps.checkForExistingArtifact.outputs.exists) + if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} run: git checkout ${{ needs.getMostRecentRelease.outputs.VERSION }} - name: Build APK - if: !fromJSON(steps.checkForExistingArtifact.outputs.exists) + if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} uses: Expensify/App/.github/actions/composite/buildAndroidAPK@main with: ARTIFACT_NAME: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} @@ -145,7 +146,7 @@ jobs: 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' + 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 From 1a1ce51fcd29a2327e01272f7e872d172aa12e4a Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 2 Mar 2023 09:22:30 -0800 Subject: [PATCH 09/12] Only run E2E tests if PR is triggering a deploy --- .github/workflows/preDeploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preDeploy.yml b/.github/workflows/preDeploy.yml index ef417b8c8c31..d80b31496773 100644 --- a/.github/workflows/preDeploy.yml +++ b/.github/workflows/preDeploy.yml @@ -224,6 +224,7 @@ jobs: e2ePerformanceTests: needs: [chooseDeployActions] + if: ${{ needs.chooseDeployActions.outputs.SHOULD_DEPLOY }} uses: Expensify/App/.github/workflows/e2ePerformanceTests.yml@main secrets: inherit with: From 2ec65cd0ed2f4d06d343520bb4076db353da9c81 Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 2 Mar 2023 09:50:18 -0800 Subject: [PATCH 10/12] Rely solely on PR_NUMBER and use the merge_commit_sha of the PR as the DELTA_REF --- .github/workflows/e2ePerformanceTests.yml | 52 ++++++++++++++--------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 351891e1203e..24d8923944ff 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -3,38 +3,51 @@ name: E2E Performance Tests on: workflow_call: inputs: - DELTA_REF: - description: A branch or commit ref to build the test build on - type: string - required: true PR_NUMBER: - description: The number of a merged PR, if this workflow is being triggered by a PR merge + 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: - DELTA_REF: - description: A branch or commit ref to build the test build on + 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: - getMostRecentRelease: + prepare: runs-on: ubuntu-latest name: Get the most recent release version 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: [getMostRecentRelease] + needs: [prepare] name: Build apk from latest release as a baseline steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -45,24 +58,25 @@ jobs: id: checkForExistingArtifact uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a with: - name: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} + 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.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' + 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.getMostRecentRelease.outputs.VERSION }} + 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.getMostRecentRelease.outputs.VERSION }} + 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 @@ -70,23 +84,23 @@ jobs: fetch-depth: 0 - name: Checkout "delta ref" - run: git checkout ${{ inputs.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-${{ inputs.DELTA_REF }} + ARTIFACT_NAME: delta-apk-${{ needs.prepare.outputs.DELTA_REF }} runTestsInAWS: runs-on: ubuntu-20.04-64core - needs: [getMostRecentRelease, buildBaseline, buildDelta] + needs: [prepare, buildBaseline, buildDelta] name: Run E2E tests in AWS device farm steps: - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 with: - ref: ${{ inputs.DELTA_REF }} + ref: ${{ needs.prepare.outputs.DELTA_REF }} - name: Make zip directory for everything to send to AWS Device Farm run: mkdir zip @@ -94,13 +108,13 @@ jobs: - name: Download baseline APK uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b with: - name: baseline-apk-${{ needs.getMostRecentRelease.outputs.VERSION }} + name: baseline-apk-${{ needs.prepare.outputs.VERSION }} path: zip - name: Download delta APK uses: actions/download-artifact@e9ef242655d12993efdcda9058dee2db83a2cb9b with: - name: delta-apk-${{ inputs.DELTA_REF }} + name: delta-apk-${{ needs.prepare.outputs.DELTA_REF }} path: zip - name: Copy e2e code into zip folder From c7a8d3aefa6e65c679da170a17e9ba7beb0d981e Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 2 Mar 2023 09:58:14 -0800 Subject: [PATCH 11/12] Skip linting of e2e performance tests due to bug in schemastore --- .github/scripts/validateActionsAndWorkflows.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/scripts/validateActionsAndWorkflows.sh b/.github/scripts/validateActionsAndWorkflows.sh index 3785f7da3352..8d186ea51a44 100755 --- a/.github/scripts/validateActionsAndWorkflows.sh +++ b/.github/scripts/validateActionsAndWorkflows.sh @@ -43,7 +43,7 @@ for ((i=0; i < ${#WORKFLOWS[@]}; i++)); do WORKFLOW=${WORKFLOWS[$i]} # Skip linting e2e workflow due to bug here: https://github.com/SchemaStore/schemastore/issues/2579 - if [[ "$WORKFLOW" == './workflows/preDeploy.yml' ]]; then + if [[ "$WORKFLOW" == './workflows/e2ePerformanceTests.yml' ]]; then continue fi From 14f9cfd5b18efa20cdc1c4b04ec5e21e86e2dbc3 Mon Sep 17 00:00:00 2001 From: rory Date: Thu, 2 Mar 2023 10:41:37 -0800 Subject: [PATCH 12/12] Fix description of prepare job --- .github/workflows/e2ePerformanceTests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 24d8923944ff..3d70d5d686c4 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -18,7 +18,7 @@ on: jobs: prepare: runs-on: ubuntu-latest - name: Get the most recent release version + name: Prepare to run builds outputs: VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} DELTA_REF: ${{ steps.getMergeCommitSha.outputs.MERGE_COMMIT_SHA }}