Skip to content

Commit

Permalink
Merge pull request #34786 from margelo/dev/fix-e2e-build-pipeline
Browse files Browse the repository at this point in the history
dev: fix failing e2ePerformanceTest android build step
  • Loading branch information
thienlnam authored Jan 22, 2024
2 parents ece96ba + 0da135e commit 4f316f3
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 88 deletions.
29 changes: 0 additions & 29 deletions .github/actions/composite/buildAndroidAPKDelta/action.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
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:
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
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 ${{ inputs.MAPBOX_SDK_DOWNLOAD_TOKEN }}
shell: bash

- 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"
Expand All @@ -19,11 +38,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 }}
78 changes: 22 additions & 56 deletions .github/workflows/e2ePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,47 +30,28 @@ 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/buildAndroidE2EAPK
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
MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

buildDelta:
runs-on: ubuntu-latest-xl
Expand Down Expand Up @@ -127,27 +108,12 @@ 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/buildAndroidE2EAPK
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
MAPBOX_SDK_DOWNLOAD_TOKEN: ${{ secrets.MAPBOX_SDK_DOWNLOAD_TOKEN }}

runTestsInAWS:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 4f316f3

Please sign in to comment.