From f69f05ea4d602063bbc678ee9f426cc7202982e0 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 12:47:10 +0200 Subject: [PATCH 01/11] feat: build baseline from previous commit --- .github/workflows/e2ePerformanceTests.yml | 39 +++++++++++++---------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index e57556143978..a9bf38b996a2 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -1,6 +1,8 @@ name: E2E Performance Tests on: + pull_request: + types: [opened, synchronize, reopened] workflow_call: inputs: PR_NUMBER: @@ -39,25 +41,28 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - name: Check if there's an existing artifact for this baseline - id: checkForExistingArtifact - uses: ./.github/actions/javascript/getArtifactInfo - with: - GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} - ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - - - name: Skip build if there's already an existing artifact for the baseline - if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} - run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' - - - name: Checkout "Baseline" commit (last release) - if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} + # - name: Check if there's an existing artifact for this baseline + # id: checkForExistingArtifact + # uses: ./.github/actions/javascript/getArtifactInfo + # with: + # GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} + # ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + + # - name: Skip build if there's already an existing artifact for the baseline + # if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} + # run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' + + - name: Checkout "Baseline" commit (prev merge commit) + # if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} + # run: | + # git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 + # git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} run: | - git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 - git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - + previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) + git checkout $previous_merge + echo $previous_merge - uses: Expensify/App/.github/actions/composite/buildAndroidE2EAPK@main - if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} + # if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} with: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} PACKAGE_SCRIPT_NAME: android-build-e2e From 67bb835605d173c4ba77dda74205032faf926520 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 12:51:40 +0200 Subject: [PATCH 02/11] fix: do not use botify token --- .github/workflows/e2ePerformanceTests.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index a9bf38b996a2..b643510400a9 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -31,15 +31,15 @@ jobs: ARTIFACT_WORKFLOW_ID: ${{ steps.checkForExistingArtifact.outputs.ARTIFACT_WORKFLOW_ID }} steps: - uses: actions/checkout@v4 - with: - # The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify (we need a PAT to access the artifact API) - token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} - - - 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 }} + # with: + # # The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify (we need a PAT to access the artifact API) + # token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} + + # - 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: Check if there's an existing artifact for this baseline # id: checkForExistingArtifact From aad08b3cd43964316e026f216afd19aa0789bcc6 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 12:55:10 +0200 Subject: [PATCH 03/11] fix: fetch entire repo history for baseline build --- .github/workflows/e2ePerformanceTests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index b643510400a9..a3f6fdfa8d82 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -31,6 +31,8 @@ jobs: ARTIFACT_WORKFLOW_ID: ${{ steps.checkForExistingArtifact.outputs.ARTIFACT_WORKFLOW_ID }} steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetches the entire history # with: # # The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify (we need a PAT to access the artifact API) # token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} From d33ed612487217b0411431e9d5bceb8a8d6c4ee1 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 13:12:36 +0200 Subject: [PATCH 04/11] fix: cleanup build file --- .github/workflows/e2ePerformanceTests.yml | 33 +---------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index a3f6fdfa8d82..6b3bff0eeb44 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -1,8 +1,6 @@ name: E2E Performance Tests on: - pull_request: - types: [opened, synchronize, reopened] workflow_call: inputs: PR_NUMBER: @@ -25,48 +23,19 @@ jobs: buildBaseline: runs-on: ubuntu-latest-xl name: Build apk from latest release as a baseline - outputs: - VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} - ARTIFACT_FOUND: ${{ steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND }} - ARTIFACT_WORKFLOW_ID: ${{ steps.checkForExistingArtifact.outputs.ARTIFACT_WORKFLOW_ID }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetches the entire history - # with: - # # The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify (we need a PAT to access the artifact API) - # token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} - - # - 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: Check if there's an existing artifact for this baseline - # id: checkForExistingArtifact - # uses: ./.github/actions/javascript/getArtifactInfo - # with: - # GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} - # ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - - # - name: Skip build if there's already an existing artifact for the baseline - # if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} - # run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' - name: Checkout "Baseline" commit (prev merge commit) - # if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} - # run: | - # git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 - # git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} run: | previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) git checkout $previous_merge echo $previous_merge - uses: Expensify/App/.github/actions/composite/buildAndroidE2EAPK@main - # if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} with: - ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + ARTIFACT_NAME: "" PACKAGE_SCRIPT_NAME: android-build-e2e APP_OUTPUT_PATH: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} From 537c5e7c5b9c6e7d72f60678451da55864db5846 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 14:06:59 +0200 Subject: [PATCH 05/11] fix: provide identifiers to baseline artifact --- .github/workflows/e2ePerformanceTests.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 6b3bff0eeb44..4306a73f866a 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -23,19 +23,24 @@ jobs: buildBaseline: runs-on: ubuntu-latest-xl name: Build apk from latest release as a baseline + outputs: + BASELINE_REF: ${{ steps.getBaselineRef.outputs.BASELINE_REF }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # Fetches the entire history - name: Checkout "Baseline" commit (prev merge commit) + id: getBaselineRef run: | previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) git checkout $previous_merge echo $previous_merge + echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" + - uses: Expensify/App/.github/actions/composite/buildAndroidE2EAPK@main with: - ARTIFACT_NAME: "" + ARTIFACT_NAME: baseline-apk-${{ steps.getBaselineRef.outputs.BASELINE_REF }} PACKAGE_SCRIPT_NAME: android-build-e2e APP_OUTPUT_PATH: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} @@ -137,11 +142,8 @@ jobs: uses: actions/download-artifact@v4 id: downloadBaselineAPK with: - name: baseline-apk-${{ needs.buildBaseline.outputs.VERSION }} + name: baseline-apk-${{ needs.buildBaseline.outputs.BASELINE_REF }} path: zip - # Set github-token only if the baseline was built in this workflow run: - github-token: ${{ needs.buildBaseline.outputs.ARTIFACT_WORKFLOW_ID && github.token }} - run-id: ${{ needs.buildBaseline.outputs.ARTIFACT_WORKFLOW_ID }} # The downloaded artifact will be a file named "app-e2e-release.apk" so we have to rename it - name: Rename baseline APK From 9c80dcf24c03d0631cd9ee62e9515278266a6d4d Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 14:42:43 +0200 Subject: [PATCH 06/11] fix: action lint --- .github/workflows/e2ePerformanceTests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 4306a73f866a..564f6218043f 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -33,10 +33,10 @@ jobs: - name: Checkout "Baseline" commit (prev merge commit) id: getBaselineRef run: | - previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) - git checkout $previous_merge - echo $previous_merge - echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" + previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) + git checkout $previous_merge + echo $previous_merge + echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" - uses: Expensify/App/.github/actions/composite/buildAndroidE2EAPK@main with: From 6c7e327f9657c32faad7267e16c441f588ac7a26 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 16:10:20 +0200 Subject: [PATCH 07/11] fix: CI checks --- .github/workflows/e2ePerformanceTests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 564f6218043f..ee6248264cb6 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -34,8 +34,8 @@ jobs: id: getBaselineRef run: | previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) - git checkout $previous_merge - echo $previous_merge + git checkout "$previous_merge" + echo "$previous_merge" echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" - uses: Expensify/App/.github/actions/composite/buildAndroidE2EAPK@main From f51fbdafff5badb0d7f11930cd6a01ac3e6ffd84 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Thu, 29 Aug 2024 16:22:32 +0200 Subject: [PATCH 08/11] fix: rename job name --- .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 ee6248264cb6..4a61feea04b0 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -22,7 +22,7 @@ concurrency: jobs: buildBaseline: runs-on: ubuntu-latest-xl - name: Build apk from latest release as a baseline + name: Build apk from baseline outputs: BASELINE_REF: ${{ steps.getBaselineRef.outputs.BASELINE_REF }} steps: From 7c22c4b912a77f61a1082cc1f73ff15efb94b891 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Mon, 21 Oct 2024 14:59:01 +0200 Subject: [PATCH 09/11] fix: changes after merge --- .github/workflows/e2ePerformanceTests.yml | 37 +++++++---------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index ff266d770363..b48c7b2175eb 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -24,9 +24,7 @@ jobs: runs-on: ubuntu-latest name: Find the baseline and delta refs, and check for an existing build artifact for that commit outputs: - BASELINE_ARTIFACT_FOUND: ${{ steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND }} - BASELINE_ARTIFACT_WORKFLOW_ID: ${{ steps.checkForExistingArtifact.outputs.ARTIFACT_WORKFLOW_ID }} - BASELINE_VERSION: ${{ steps.getMostRecentRelease.outputs.VERSION }} + BASELINE_REF: ${{ steps.getBaselineRef.outputs.BASELINE_REF }} DELTA_REF: ${{ steps.getDeltaRef.outputs.DELTA_REF }} IS_PR_MERGED: ${{ steps.getPullRequestDetails.outputs.IS_MERGED }} steps: @@ -34,22 +32,13 @@ jobs: with: fetch-depth: 0 # Fetches the entire history - - 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: Check if there's an existing artifact for this baseline - id: checkForExistingArtifact - uses: ./.github/actions/javascript/getArtifactInfo - with: - GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} - ARTIFACT_NAME: baseline-${{ steps.getMostRecentRelease.outputs.VERSION }}android-artifact-apk - - - name: Skip build if there's already an existing artifact for the baseline - if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.ARTIFACT_FOUND) }} - run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' + - name: Determine "baseline ref" (prev merge commit) + id: getBaselineRef + run: | + previous_merge=$(git rev-list --merges HEAD~1 | head -n 1) + git checkout "$previous_merge" + echo "$previous_merge" + echo "BASELINE_REF=$previous_merge" >> "$GITHUB_OUTPUT" - name: Get pull request details id: getPullRequestDetails @@ -83,15 +72,14 @@ jobs: fi buildBaseline: - name: Build apk from latest release as a baseline + name: Build apk from baseline uses: ./.github/workflows/buildAndroid.yml needs: prep - if: ${{ !fromJSON(needs.prep.outputs.BASELINE_ARTIFACT_FOUND) }} secrets: inherit with: type: e2e - ref: ${{ needs.prep.outputs.BASELINE_VERSION }} - artifact-prefix: baseline-${{ needs.prep.outputs.BASELINE_VERSION }} + ref: ${{ needs.prep.outputs.BASELINE_REF }} + artifact-prefix: baseline-${{ needs.prep.outputs.BASELINE_REF }} buildDelta: name: Build apk from delta ref @@ -126,9 +114,6 @@ jobs: with: name: ${{ needs.buildBaseline.outputs.APK_ARTIFACT_NAME }} path: zip - # Set github-token only if the baseline was built in this workflow run: - github-token: ${{ needs.prep.outputs.BASELINE_ARTIFACT_WORKFLOW_ID && github.token }} - run-id: ${{ needs.prep.outputs.BASELINE_ARTIFACT_WORKFLOW_ID }} # The downloaded artifact will be a file named "app-e2e-release.apk" so we have to rename it - name: Rename baseline APK From 8e50ead5123e371b5be1a89a6453df79d149eada Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Mon, 21 Oct 2024 15:05:44 +0200 Subject: [PATCH 10/11] chore: test build --- .github/workflows/buildAndroid.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildAndroid.yml b/.github/workflows/buildAndroid.yml index c88542068b92..3637e0b7df8a 100644 --- a/.github/workflows/buildAndroid.yml +++ b/.github/workflows/buildAndroid.yml @@ -53,7 +53,7 @@ on: jobs: build: name: Build Android app - runs-on: ubuntu-latest-xl + runs-on: ubuntu-latest env: RUBYOPT: '-rostruct' outputs: @@ -67,8 +67,8 @@ jobs: with: ref: ${{ inputs.ref }} - - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + #- name: Configure MapBox SDK + # run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - name: Setup Node uses: ./.github/actions/composite/setupNode From 16e75ac421c5bfcd397abc664ae6bc423874b619 Mon Sep 17 00:00:00 2001 From: kirillzyusko Date: Mon, 21 Oct 2024 15:12:32 +0200 Subject: [PATCH 11/11] fix: revert test changes --- .github/workflows/buildAndroid.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildAndroid.yml b/.github/workflows/buildAndroid.yml index 3637e0b7df8a..c88542068b92 100644 --- a/.github/workflows/buildAndroid.yml +++ b/.github/workflows/buildAndroid.yml @@ -53,7 +53,7 @@ on: jobs: build: name: Build Android app - runs-on: ubuntu-latest + runs-on: ubuntu-latest-xl env: RUBYOPT: '-rostruct' outputs: @@ -67,8 +67,8 @@ jobs: with: ref: ${{ inputs.ref }} - #- name: Configure MapBox SDK - # run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + - name: Configure MapBox SDK + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} - name: Setup Node uses: ./.github/actions/composite/setupNode