From bc3063303b2f6e0343976faaa65cc0c9a14e24a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 19 Jan 2024 09:17:04 +0100 Subject: [PATCH 1/4] cleanup: use buildAndroidAPKaction --- .../composite/buildAndroidAPK/action.yml | 14 +++- .../composite/buildAndroidAPKDelta/action.yml | 29 ------- .github/workflows/e2ePerformanceTests.yml | 76 +++++-------------- 3 files changed, 32 insertions(+), 87 deletions(-) delete mode 100644 .github/actions/composite/buildAndroidAPKDelta/action.yml diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index 4f466be84a68..975b8e4be7cf 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -5,10 +5,20 @@ inputs: ARTIFACT_NAME: description: The name of the workflow artifact where the APK should be uploaded required: true + PACKAGE_SCRIPT_NAME: + description: The name of the npm script to run to build the APK + required: true + APP_OUTPUT_PATH: + description: The path to the built APK + required: true runs: using: composite steps: + - name: Configure MapBox SDK + run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + shell: bash + - uses: Expensify/App/.github/actions/composite/setupNode@main - uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011 @@ -19,11 +29,11 @@ runs: - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef - name: Build APK - run: npm run android-build-e2e + run: npm run ${{ inputs.PACKAGE_SCRIPT_NAME }} shell: bash - name: Upload APK uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 with: name: ${{ inputs.ARTIFACT_NAME }} - path: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk + path: ${{ inputs.APP_OUTPUT_PATH }} diff --git a/.github/actions/composite/buildAndroidAPKDelta/action.yml b/.github/actions/composite/buildAndroidAPKDelta/action.yml deleted file mode 100644 index f466bb2a061a..000000000000 --- a/.github/actions/composite/buildAndroidAPKDelta/action.yml +++ /dev/null @@ -1,29 +0,0 @@ -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 diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 75c0b8497bdd..b8e5577f28d8 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -30,47 +30,27 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - # - name: Check if there's an existing artifact for this baseline - # id: checkForExistingArtifact - # uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a - # with: - # 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.exists) }} - # 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.exists) }} - # run: | - # git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 - # git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - - - name: Checkout latest main commit (TODO temporary until new version is released) - run: git switch --detach main - - - uses: ./.github/actions/composite/setupNode - - - uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011 + - name: Check if there's an existing artifact for this baseline + id: checkForExistingArtifact + uses: xSAVIKx/artifact-exists-action@3c5206b1411c0d2fc0840f56b7140646933d9d6a with: - ruby-version: "2.7" - bundler-cache: true - - - uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef + name: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + - name: Skip build if there's already an existing artifact for the baseline + if: ${{ fromJSON(steps.checkForExistingArtifact.outputs.exists) }} + run: echo 'APK for baseline ${{ steps.getMostRecentRelease.outputs.VERSION }} already exists, reusing existing build' - - name: Build APK - run: npm run android-build-e2e - shell: bash + - name: Checkout "Baseline" commit (last release) + if: ${{ !fromJSON(steps.checkForExistingArtifact.outputs.exists) }} + run: | + git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 + git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - - name: Upload APK - uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 + - uses: ./.github/actions/composite/buildAndroidAPK with: - name: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} - path: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk - + ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} + PACKAGE_SCRIPT_NAME: android-build-e2e + APP_OUTPUT_PATH: android/app/build/outputs/apk/e2e/release/app-e2e-release.apk buildDelta: runs-on: ubuntu-latest-xl @@ -127,27 +107,11 @@ jobs: - name: Checkout "delta ref" run: git checkout ${{ steps.getDeltaRef.outputs.DELTA_REF }} - - 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 - run: npm run android-build-e2edelta - shell: bash - - - name: Upload APK - uses: actions/upload-artifact@65d862660abb392b8c4a3d1195a2108db131dd05 + - uses: ./.github/actions/composite/buildAndroidAPK with: - name: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} - path: android/app/build/outputs/apk/e2edelta/release/app-e2edelta-release.apk + ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} + PACKAGE_SCRIPT_NAME: android-build-e2edelta + APP_OUTPUT_PATH: android/app/build/outputs/apk/e2edelta/release/app-e2edelta-release.apk runTestsInAWS: runs-on: ubuntu-latest From 1aab554ed9400b64dc609e8e5447a0700b218aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 19 Jan 2024 09:19:02 +0100 Subject: [PATCH 2/4] gh action: pass mapbox token as input --- .github/actions/composite/buildAndroidAPK/action.yml | 5 ++++- .github/workflows/e2ePerformanceTests.yml | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index 975b8e4be7cf..d5499def8d5b 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -11,12 +11,15 @@ inputs: APP_OUTPUT_PATH: description: The path to the built APK required: true + MAPBOX_SDK_DOWNLOAD_TOKEN: + description: The token to use to download the MapBox SDK + required: true runs: using: composite steps: - name: Configure MapBox SDK - run: ./scripts/setup-mapbox-sdk.sh ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} + run: ./scripts/setup-mapbox-sdk.sh ${{ inputs.MAPBOX_SDK_DOWNLOAD_TOKEN }} shell: bash - uses: Expensify/App/.github/actions/composite/setupNode@main diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index b8e5577f28d8..48353daef565 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -51,6 +51,7 @@ jobs: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} 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 }} buildDelta: runs-on: ubuntu-latest-xl @@ -112,6 +113,7 @@ jobs: ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} PACKAGE_SCRIPT_NAME: android-build-e2edelta APP_OUTPUT_PATH: android/app/build/outputs/apk/e2edelta/release/app-e2edelta-release.apk + MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }} runTestsInAWS: runs-on: ubuntu-latest From ab2aabf42c7b4d37e0549c2683c3a33c931ab965 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 19 Jan 2024 09:20:37 +0100 Subject: [PATCH 3/4] e2e gh action: setup java version to 17 --- .github/actions/composite/buildAndroidAPK/action.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidAPK/action.yml index d5499def8d5b..8642edbdc5f7 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidAPK/action.yml @@ -24,6 +24,12 @@ runs: - uses: Expensify/App/.github/actions/composite/setupNode@main + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: "oracle" + java-version: "17" + - uses: ruby/setup-ruby@a05e47355e80e57b9a67566a813648fa67d92011 with: ruby-version: "2.7" From 0da135ed3c507980d4e1a0b7d4f2d69bfd426569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hanno=20J=2E=20G=C3=B6decke?= Date: Fri, 19 Jan 2024 09:26:14 +0100 Subject: [PATCH 4/4] change name of compose action to buildAndroidE2EAPK --- .../{buildAndroidAPK => buildAndroidE2EAPK}/action.yml | 2 +- .github/workflows/e2ePerformanceTests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename .github/actions/composite/{buildAndroidAPK => buildAndroidE2EAPK}/action.yml (97%) diff --git a/.github/actions/composite/buildAndroidAPK/action.yml b/.github/actions/composite/buildAndroidE2EAPK/action.yml similarity index 97% rename from .github/actions/composite/buildAndroidAPK/action.yml rename to .github/actions/composite/buildAndroidE2EAPK/action.yml index 8642edbdc5f7..b4fc05c7ebe9 100644 --- a/.github/actions/composite/buildAndroidAPK/action.yml +++ b/.github/actions/composite/buildAndroidE2EAPK/action.yml @@ -1,4 +1,4 @@ -name: Build an Android apk +name: Build an Android apk for e2e tests description: Build an Android apk for an E2E test build and upload it as an artifact inputs: diff --git a/.github/workflows/e2ePerformanceTests.yml b/.github/workflows/e2ePerformanceTests.yml index 48353daef565..bd3af08ae25e 100644 --- a/.github/workflows/e2ePerformanceTests.yml +++ b/.github/workflows/e2ePerformanceTests.yml @@ -46,7 +46,7 @@ jobs: git fetch origin tag ${{ steps.getMostRecentRelease.outputs.VERSION }} --no-tags --depth=1 git switch --detach ${{ steps.getMostRecentRelease.outputs.VERSION }} - - uses: ./.github/actions/composite/buildAndroidAPK + - uses: ./.github/actions/composite/buildAndroidE2EAPK with: ARTIFACT_NAME: baseline-apk-${{ steps.getMostRecentRelease.outputs.VERSION }} PACKAGE_SCRIPT_NAME: android-build-e2e @@ -108,7 +108,7 @@ jobs: - name: Checkout "delta ref" run: git checkout ${{ steps.getDeltaRef.outputs.DELTA_REF }} - - uses: ./.github/actions/composite/buildAndroidAPK + - uses: ./.github/actions/composite/buildAndroidE2EAPK with: ARTIFACT_NAME: delta-apk-${{ steps.getDeltaRef.outputs.DELTA_REF }} PACKAGE_SCRIPT_NAME: android-build-e2edelta