From de0d681864e7f568cd9553548184a01eb49152fb Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 29 Jan 2025 13:59:16 +0100 Subject: [PATCH 1/7] generate keys & always print profiling report --- .github/workflows/compareNDandODbuilds.yml | 59 ++++++++++++++-------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index f7de861d71f9..9eeff7267fc6 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -30,19 +30,38 @@ jobs: with: IS_HYBRID_BUILD: 'true' + - name: Install 1Password CLI + uses: 1password/install-cli-action@v1 + + - name: Load files from 1Password + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + run: | + op document get --output ./upload-key.keystore upload-key.keystore + op document get --output ./android-fastlane-json-key.json android-fastlane-json-key.json + # Copy the keystore to the Android directory for Fullstory + cp ./upload-key.keystore Mobile-Expensify/Android + + - name: Load Android upload keystore credentials from 1Password + id: load-credentials + uses: 1password/load-secrets-action@v2 + with: + export-env: false + env: + OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} + ANDROID_UPLOAD_KEYSTORE_PASSWORD: op://Mobile-Deploy-CI/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_PASSWORD + ANDROID_UPLOAD_KEYSTORE_ALIAS: op://Mobile-Deploy-CI/Repository-Secrets/ANDROID_UPLOAD_KEYSTORE_ALIAS + ANDROID_UPLOAD_KEY_PASSWORD: op://Mobile-Deploy-CI/Repository-Secrets/ANDROID_UPLOAD_KEY_PASSWORD + - name: Build Android Release working-directory: Mobile-Expensify/Android run: | - if ! ./gradlew --profile assembleRelease - then - echo "❌ Android HybridApp failed to build: Please reach out to Contributor+ and/or Expensify engineers for help in #expensify-open-source to resolve." - exit 1 - else - echo "✅ Build succeeded. Printing Gradle profile report:" - # Print the latest generated profile report - PROFILE_REPORT=$(find build/reports/profile -maxdepth 1 -type f) - cat "$PROFILE_REPORT" - fi + ./gradlew --profile assembleRelease + + echo "Printing Gradle profile report:" + # Print the latest generated profile report + PROFILE_REPORT=$(find build/reports/profile -maxdepth 1 -type f) + cat "$PROFILE_REPORT" buildStandaloneAndroid: name: Build Standalone Android @@ -62,16 +81,16 @@ jobs: with: IS_HYBRID_BUILD: 'false' + - name: Decrypt keystore to sign the APK/AAB + run: gpg --batch --yes --decrypt --passphrase="${{ secrets.LARGE_SECRET_PASSPHRASE }}" --output my-upload-key.keystore my-upload-key.keystore.gpg + working-directory: android/app + - name: Build Android Release working-directory: android run: | - if ! ./gradlew --profile assembleProductionRelease - then - echo "❌ Android Standalone failed to build: Please reach out to Contributor+ and/or Expensify engineers for help in #expensify-open-source to resolve." - exit 1 - else - echo "✅ Build succeeded. Printing Gradle profile report:" - # Print the latest generated profile report - PROFILE_REPORT=$(find build/reports/profile -maxdepth 1 -type f) - cat "$PROFILE_REPORT" - fi + ./gradlew --profile assembleProductionRelease + + echo "Printing Gradle profile report:" + # Print the latest generated profile report + PROFILE_REPORT=$(find build/reports/profile -maxdepth 1 -type f) + cat "$PROFILE_REPORT" From 3c52948ae5395a47eb309c7e9c0141be73295d55 Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 29 Jan 2025 14:14:57 +0100 Subject: [PATCH 2/7] use envs in hybrid app build --- .github/workflows/compareNDandODbuilds.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index 9eeff7267fc6..e3a7e768de6f 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -55,6 +55,10 @@ jobs: - name: Build Android Release working-directory: Mobile-Expensify/Android + env: + ANDROID_UPLOAD_KEYSTORE_PASSWORD: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} + ANDROID_UPLOAD_KEYSTORE_ALIAS: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} + ANDROID_UPLOAD_KEY_PASSWORD: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} run: | ./gradlew --profile assembleRelease From bbeb0742fbedaf86a566e7e9d7257366379ee9f0 Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 29 Jan 2025 14:39:03 +0100 Subject: [PATCH 3/7] pass keys to gradlew --- .github/workflows/compareNDandODbuilds.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index e3a7e768de6f..5e80a52b9301 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -55,12 +55,12 @@ jobs: - name: Build Android Release working-directory: Mobile-Expensify/Android - env: - ANDROID_UPLOAD_KEYSTORE_PASSWORD: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} - ANDROID_UPLOAD_KEYSTORE_ALIAS: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} - ANDROID_UPLOAD_KEY_PASSWORD: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} run: | - ./gradlew --profile assembleRelease + ./gradlew --profile assembleRelease \ + -Pandroid.injected.signing.store.file="./upload-key.keystore" \ + -Pandroid.injected.signing.store.password=${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }} \ + -Pandroid.injected.signing.key.alias=${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }} \ + -Pandroid.injected.signing.key.password=${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }} echo "Printing Gradle profile report:" # Print the latest generated profile report From 62a5873ffa1b03ad2cabda85f599d84667c51347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Warcho=C5=82?= <61014013+war-in@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:47:29 +0100 Subject: [PATCH 4/7] Update .github/workflows/compareNDandODbuilds.yml Co-authored-by: Jan Nowakowski <56261019+jnowakow@users.noreply.github.com> --- .github/workflows/compareNDandODbuilds.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index 5e80a52b9301..4cac1e00439d 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -91,6 +91,9 @@ jobs: - name: Build Android Release working-directory: android + env: + MYAPP_UPLOAD_STORE_PASSWORD: ${{ secrets.MYAPP_UPLOAD_STORE_PASSWORD }} + MYAPP_UPLOAD_KEY_PASSWORD: ${{ secrets.MYAPP_UPLOAD_KEY_PASSWORD }} run: | ./gradlew --profile assembleProductionRelease From 2a072e2c909b1ca49b1792a24a5bcc56aef6690a Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 29 Jan 2025 15:36:47 +0100 Subject: [PATCH 5/7] add missing steps --- .github/workflows/compareNDandODbuilds.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index 4cac1e00439d..27fc1b4707ea 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -30,6 +30,25 @@ jobs: with: IS_HYBRID_BUILD: 'true' + - name: Run grunt build + run: | + cd Mobile-Expensify + npm run grunt:build:shared + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'oracle' + java-version: '17' + + - name: Setup Ruby + uses: ruby/setup-ruby@v1.190.0 + with: + bundler-cache: true + + - name: Install New Expensify Gems + run: bundle install + - name: Install 1Password CLI uses: 1password/install-cli-action@v1 From 698f86e9c5b20c0641d6ef2779a50b67e654a871 Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 29 Jan 2025 16:15:37 +0100 Subject: [PATCH 6/7] remove ruby --- .github/workflows/compareNDandODbuilds.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index 27fc1b4707ea..721d85edb809 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -41,14 +41,6 @@ jobs: distribution: 'oracle' java-version: '17' - - name: Setup Ruby - uses: ruby/setup-ruby@v1.190.0 - with: - bundler-cache: true - - - name: Install New Expensify Gems - run: bundle install - - name: Install 1Password CLI uses: 1password/install-cli-action@v1 From 12c226b9d17dee8fea5bb440ab414dedf6977e70 Mon Sep 17 00:00:00 2001 From: war-in Date: Wed, 29 Jan 2025 16:17:46 +0100 Subject: [PATCH 7/7] replace runner --- .github/workflows/compareNDandODbuilds.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compareNDandODbuilds.yml b/.github/workflows/compareNDandODbuilds.yml index 721d85edb809..51ba44a192e9 100644 --- a/.github/workflows/compareNDandODbuilds.yml +++ b/.github/workflows/compareNDandODbuilds.yml @@ -6,7 +6,7 @@ on: jobs: buildHybridAppAndroid: name: Build HybridApp Android - runs-on: macos-15-xlarge + runs-on: ubuntu-latest-xl steps: - name: Checkout uses: actions/checkout@v4 @@ -41,6 +41,14 @@ jobs: distribution: 'oracle' java-version: '17' + - name: Setup Ruby + uses: ruby/setup-ruby@v1.190.0 + with: + bundler-cache: true + + - name: Install New Expensify Gems + run: bundle install + - name: Install 1Password CLI uses: 1password/install-cli-action@v1 @@ -80,7 +88,7 @@ jobs: buildStandaloneAndroid: name: Build Standalone Android - runs-on: macos-15-xlarge + runs-on: ubuntu-latest-xl steps: - name: Checkout uses: actions/checkout@v4