Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 41 additions & 35 deletions .github/workflows/buildAndroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,38 +146,6 @@ jobs:
aws-region: us-east-1

- name: Rock Remote Build - Android
id: rock-remote-build-android
continue-on-error: true
uses: callstackincubator/android@4cedf4d9b5c167452c96fe67233577e0fde9a025
env:
GITHUB_TOKEN: ${{ github.token }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
IS_HYBRID_APP: true
FORCE_NATIVE_BUILD: ${{ inputs.force-native-build == 'true' && github.run_id || '' }}
with:
variant: ${{ inputs.variant }}
sign: true
re-sign: true
ad-hoc: ${{ inputs.variant == 'Adhoc' }}
keystore-file: './upload-key.keystore'
keystore-store-file: 'upload-key.keystore'
keystore-store-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_PASSWORD }}
keystore-key-alias: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEYSTORE_ALIAS }}
keystore-key-password: ${{ steps.load-credentials.outputs.ANDROID_UPLOAD_KEY_PASSWORD }}
keystore-path: '../tools/buildtools/upload-key.keystore'
comment-bot: false
rock-build-extra-params: ${{ inputs.variant == 'Adhoc' && '--extra-params "-PreactNativeArchitectures=arm64-v8a,x86_64 --profile"' || '--extra-params "--profile"' }}
custom-identifier: ${{ steps.computeIdentifier.outputs.IDENTIFIER }}
validate-elf-alignment: false

- name: Clear Gradle cache
if: steps.rock-remote-build-android.outcome == 'failure'
run: |
echo "::warning::Android build failed, clearing Gradle caches and retrying…"
rm -rf ~/.gradle/caches

- name: Rock Remote Build - Android (retry)
if: steps.rock-remote-build-android.outcome == 'failure'
uses: callstackincubator/android@4cedf4d9b5c167452c96fe67233577e0fde9a025
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down Expand Up @@ -215,12 +183,38 @@ jobs:
run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT"

- name: Collect build artifacts
id: collectArtifacts
run: |
mkdir -p /tmp/android-artifacts
find Mobile-Expensify/Android/app/build/outputs/bundle -name '*.aab' -exec cp {} /tmp/android-artifacts/ \;
find Mobile-Expensify/Android/build/generated/sourcemaps/react -name 'index.android.bundle.map' -exec cp {} /tmp/android-artifacts/ \;

AAB_FILE=$(find Mobile-Expensify/Android -path '*/outputs/bundle/*/*.aab' -print -quit 2>/dev/null || true)
if [ -n "$AAB_FILE" ]; then
echo "Found AAB: $AAB_FILE"
cp "$AAB_FILE" /tmp/android-artifacts/
echo "HAS_AAB=true" >> "$GITHUB_OUTPUT"
else
echo "::warning::No AAB file found (expected for remote-cache hits on Adhoc builds)"
echo "HAS_AAB=false" >> "$GITHUB_OUTPUT"
fi

MAP_FILE=$(find Mobile-Expensify/Android -path '*/sourcemaps/react/*/index.android.bundle.map' -print -quit 2>/dev/null || true)
if [ -n "$MAP_FILE" ]; then
echo "Found sourcemap: $MAP_FILE"
cp "$MAP_FILE" /tmp/android-artifacts/
else
echo "::warning::No Android sourcemap found"
fi

MAPPING_FILE=$(find Mobile-Expensify/Android -path '*/outputs/mapping/*/mapping.txt' -print -quit 2>/dev/null || true)
if [ -n "$MAPPING_FILE" ]; then
echo "Found proguard mapping: $MAPPING_FILE"
cp "$MAPPING_FILE" /tmp/android-artifacts/
else
echo "::warning::No proguard mapping file found"
fi

- name: Find and upload AAB artifact
if: steps.collectArtifacts.outputs.HAS_AAB == 'true'
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
Expand All @@ -233,8 +227,18 @@ jobs:
with:
name: ${{ inputs.artifact-prefix }}android-sourcemap-artifact
path: /tmp/android-artifacts/index.android.bundle.map
if-no-files-found: warn

- name: Upload proguard mapping artifact
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: ${{ inputs.artifact-prefix }}android-proguard-mapping
path: /tmp/android-artifacts/mapping.txt
if-no-files-found: warn

- name: Install bundletool
if: steps.collectArtifacts.outputs.HAS_AAB == 'true'
run: |
readonly BUNDLETOOL_VERSION="1.18.1"
readonly BUNDLETOOL_URL="https://github.com/google/bundletool/releases/download/${BUNDLETOOL_VERSION}/bundletool-all-${BUNDLETOOL_VERSION}.jar"
Expand All @@ -247,8 +251,9 @@ jobs:
fi

- name: Generate APK from AAB
if: steps.collectArtifacts.outputs.HAS_AAB == 'true'
run: |
AAB_PATH=$(find Mobile-Expensify/Android/app/build/outputs/bundle -name '*.aab' | head -1)
AAB_PATH=$(find Mobile-Expensify/Android -path '*/outputs/bundle/*/*.aab' | head -1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB - for consistency should we read it from /tmp/android-artifacts/? Doesn't change much though.

java -jar bundletool.jar build-apks --bundle="$AAB_PATH" --output=Expensify.apks \
--mode=universal \
--ks=upload-key.keystore \
Expand All @@ -258,6 +263,7 @@ jobs:
unzip -p Expensify.apks universal.apk > Expensify.apk

- name: Upload Android APK build artifact
if: steps.collectArtifacts.outputs.HAS_AAB == 'true'
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
Expand Down
20 changes: 19 additions & 1 deletion .github/workflows/buildIOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,32 @@ jobs:
name: ${{ inputs.artifact-prefix }}iosBuild-artifact
path: .rock/cache/ios/export/*.ipa

- name: Zip dSYMs from xcarchive
id: zip-dsyms
continue-on-error: true
run: |
DSYM_DIR=".rock/cache/ios/archive/Expensify.xcarchive/dSYMs"
if [ -d "$DSYM_DIR" ] && ls "$DSYM_DIR"/*.dSYM 1>/dev/null 2>&1; then
cd "$DSYM_DIR"
for dsym in ./*.dSYM; do
zip -r "${dsym}.zip" "$dsym"
done
echo "DSYM_PATH=$DSYM_DIR" >> "$GITHUB_OUTPUT"
echo "Found and zipped dSYMs:"
ls -la ./*.dSYM.zip
else
echo "::warning::No dSYMs found in xcarchive"
fi

- name: Find and upload dSYM artifact
id: upload-dsym
if: steps.zip-dsyms.outputs.DSYM_PATH != ''
continue-on-error: true
# v6
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f
with:
name: ${{ inputs.artifact-prefix }}ios-dsym-artifact
path: .rock/cache/ios/export/*.dSYM.zip
path: ${{ steps.zip-dsyms.outputs.DSYM_PATH }}/*.dSYM.zip
if-no-files-found: warn

- name: Log dSYM upload failure
Expand Down
Loading