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
71 changes: 71 additions & 0 deletions .github/actions/composite/uploadSentrySizeAnalysis/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Upload build to Sentry for size analysis
description: |
Download a platform binary and upload it to Sentry for size analysis. The binary is sourced
from either the current workflow run's artifacts (cherry-pick prod deploys, which build natively)
or the matching staging GitHub Release (re-promotion prod deploys, which do not build natively).

inputs:
platform:
description: "Platform label used in the GH Actions notice (e.g. 'Android' or 'iOS')"
required: true
asset-name:
description: "Filename of the binary on disk and as the GH Release asset (e.g. 'Expensify-release.aab')"
required: true
artifact-name:
description: "Name of the GH Actions artifact to download for cherry-pick deploys (e.g. 'androidBuild-artifact')"
required: true
staging-release-tag:
description: "Tag of the staging GH Release to download from for re-promotion deploys (e.g. '9.4.13-0-staging')"
required: true
is-cherry-pick:
description: "'true' when this deploy is a cherry-pick (binary is in the current run); 'false' otherwise (binary is on the staging release)"
required: true

outputs:
SENTRY_URL:
description: URL to the Sentry size analysis for the uploaded build (empty if upload failed or quota exhausted)
value: ${{ steps.upload.outputs.SENTRY_URL }}

runs:
using: composite
steps:
- name: Setup Node
uses: ./.github/actions/composite/setupNode

- name: Download binary from current workflow run (cherry-pick path)
if: ${{ inputs.is-cherry-pick == 'true' }}

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 ${{ }} isn't necessary on if

continue-on-error: true
# v7
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131
with:
name: ${{ inputs.artifact-name }}
path: ./

- name: Download binary from the staging GitHub Release (re-promotion path)
if: ${{ inputs.is-cherry-pick != 'true' }}
continue-on-error: true
shell: bash
env:
TAG: ${{ inputs.staging-release-tag }}
ASSET: ${{ inputs.asset-name }}
run: |
gh release download "$TAG" --pattern "$ASSET" --output "$ASSET"
[ -s "$ASSET" ] || { echo "::error::Failed to obtain $ASSET from $TAG"; exit 1; }

- name: Upload to Sentry
id: upload
if: ${{ hashFiles(inputs.asset-name) != '' }}
continue-on-error: true
Comment on lines +55 to +58

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Prevent optional Sentry uploads from failing deploy

In production deploys where npx sentry-cli build upload stalls or the new upload job hits its 10-minute job timeout, the whole androidUploadSentry/iosUploadSentry job fails even though this step is marked continue-on-error; job-level timeouts are not covered by the step's error handling. The old build-workflow upload had a step-level timeout with continue-on-error, so Sentry outages could not flip an otherwise successful deploy red. Please keep the timeout/error handling at the upload step (or make the job non-blocking) so size analysis remains optional.

Useful? React with 👍 / 👎.

shell: bash
env:
ASSET: ${{ inputs.asset-name }}
PLATFORM: ${{ inputs.platform }}
run: |
OUTPUT=$(npx sentry-cli build upload "$ASSET" \
--org expensify --project app --build-configuration Release --log-level info 2>&1)
echo "$OUTPUT"
SENTRY_URL=$(echo "$OUTPUT" | grep -oE 'https://expensify\.sentry\.io/[^ )"}]+' | head -1)
if [ -n "$SENTRY_URL" ]; then
echo "::notice::${PLATFORM} Sentry size analysis: $SENTRY_URL"
echo "SENTRY_URL=$SENTRY_URL" >> "$GITHUB_OUTPUT"
fi
20 changes: 0 additions & 20 deletions .github/workflows/buildAndroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ on:
ROCK_ARTIFACT_URL:
description: URL to download the ad-hoc build artifact (adhoc only)
value: ${{ jobs.build.outputs.ROCK_ARTIFACT_URL }}
SENTRY_URL:
description: URL to Sentry size analysis
value: ${{ jobs.build.outputs.SENTRY_URL }}
AAB_FILENAME:
description: Filename of the AAB artifact (empty if no AAB was produced)
value: ${{ jobs.build.outputs.AAB_FILENAME }}
Expand All @@ -60,7 +57,6 @@ jobs:
outputs:
VERSION_CODE: ${{ steps.getAndroidVersion.outputs.VERSION_CODE }}
ROCK_ARTIFACT_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }}
SENTRY_URL: ${{ steps.sentry-upload.outputs.SENTRY_URL }}
AAB_FILENAME: ${{ steps.collectArtifacts.outputs.AAB_FILENAME }}
APK_FILENAME: ${{ steps.collectArtifacts.outputs.APK_FILENAME }}
SOURCEMAP_FILENAME: index.android.bundle.map
Expand Down Expand Up @@ -195,22 +191,6 @@ jobs:
if: ${{ inputs.variant == 'Adhoc' }}
run: echo "ARTIFACT_URL=$ARTIFACT_URL" >> "$GITHUB_OUTPUT"

- name: Upload Android build to Sentry for size analysis
id: sentry-upload
if: ${{ inputs.variant == 'Release' && env.ARTIFACT_PATH != '' }}
continue-on-error: true
timeout-minutes: 5
run: |
OUTPUT=$(npx sentry-cli build upload "$ARTIFACT_PATH" --org expensify --project app --build-configuration Release --log-level debug 2>&1)
echo "$OUTPUT"
SENTRY_URL=$(echo "$OUTPUT" | grep -oE 'https://expensify\.sentry\.io/[^ "}]+' | head -1)
if [ -n "$SENTRY_URL" ]; then
echo "::notice::Android Sentry size analysis: $SENTRY_URL"
echo "SENTRY_URL=$SENTRY_URL" >> "$GITHUB_OUTPUT"
fi
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: Upload Gradle profile report
if: always()
# v6
Expand Down
20 changes: 0 additions & 20 deletions .github/workflows/buildIOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ on:
ROCK_ARTIFACT_URL:
description: URL to download the ad-hoc build artifact (adhoc only)
value: ${{ jobs.build.outputs.ROCK_ARTIFACT_URL }}
SENTRY_URL:
description: URL to Sentry size analysis
value: ${{ jobs.build.outputs.SENTRY_URL }}
IPA_FILENAME:
description: Filename of the IPA artifact produced by the build
value: ${{ jobs.build.outputs.IPA_FILENAME }}
Expand All @@ -58,7 +55,6 @@ jobs:
outputs:
IOS_VERSION: ${{ steps.getIOSVersion.outputs.IOS_VERSION }}
ROCK_ARTIFACT_URL: ${{ steps.set-artifact-url.outputs.ARTIFACT_URL }}
SENTRY_URL: ${{ steps.sentry-upload.outputs.SENTRY_URL }}
IPA_FILENAME: ${{ steps.set-ipa-filename.outputs.IPA_FILENAME }}
DSYM_FILENAME: ${{ steps.set-ipa-filename.outputs.DSYM_FILENAME }}
SOURCEMAP_FILENAME: main.jsbundle.map
Expand Down Expand Up @@ -244,22 +240,6 @@ jobs:
comment-bot: false
custom-identifier: ${{ steps.computeIdentifier.outputs.IDENTIFIER }}

- name: Upload iOS build to Sentry for size analysis
id: sentry-upload
if: ${{ inputs.variant == 'Release' && env.ARTIFACT_PATH != '' }}
continue-on-error: true
timeout-minutes: 5
run: |
OUTPUT=$(npx sentry-cli build upload "$ARTIFACT_PATH" --org expensify --project app --build-configuration Release --log-level debug 2>&1)
echo "$OUTPUT"
SENTRY_URL=$(echo "$OUTPUT" | grep -oE 'https://expensify\.sentry\.io/[^ "}]+' | head -1)
if [ -n "$SENTRY_URL" ]; then
echo "::notice::iOS Sentry size analysis: $SENTRY_URL"
echo "SENTRY_URL=$SENTRY_URL" >> "$GITHUB_OUTPUT"
fi
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}

- name: Set artifact URL output
id: set-artifact-url
if: ${{ inputs.variant == 'Adhoc' }}
Expand Down
68 changes: 65 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,68 @@ jobs:
}]
}

# Upload the production-bound binary to Sentry for size analysis.
# - Cherry-pick deploys build native in this run, so we pull the .aab/.ipa from the build artifact.
# - Re-promotion deploys don't build native, so we download from the matching `<TAG>-staging`
# GitHub Release populated during the staging deploy of that version.
androidUploadSentry:
name: Upload Android build to Sentry for size analysis
needs: [prep, androidBuild, checkDeploymentSuccess]
runs-on: blacksmith-2vcpu-ubuntu-2404
if: >-
${{ always()
&& needs.prep.outputs.DEPLOY_ENV == 'production'
&& fromJSON(needs.checkDeploymentSuccess.outputs.IS_RELEASE_READY) }}
continue-on-error: true
timeout-minutes: 10
outputs:
SENTRY_URL: ${{ steps.sentry-upload.outputs.SENTRY_URL }}
steps:
- name: Checkout
uses: useblacksmith/checkout@c9796daa2a4bdebdab5bd16be2c09a70cd4e1121 # v1

- name: Upload to Sentry for size analysis
id: sentry-upload
uses: ./.github/actions/composite/uploadSentrySizeAnalysis
env:
GH_TOKEN: ${{ github.token }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
platform: Android
asset-name: Expensify-release.aab
artifact-name: androidBuild-artifact
staging-release-tag: ${{ needs.prep.outputs.TAG }}-staging
is-cherry-pick: ${{ needs.prep.outputs.IS_CHERRY_PICK }}

iosUploadSentry:
name: Upload iOS build to Sentry for size analysis
needs: [prep, iosBuild, checkDeploymentSuccess]
runs-on: blacksmith-2vcpu-ubuntu-2404
if: >-
${{ always()
&& needs.prep.outputs.DEPLOY_ENV == 'production'
&& fromJSON(needs.checkDeploymentSuccess.outputs.IS_RELEASE_READY) }}
continue-on-error: true
timeout-minutes: 10
outputs:
SENTRY_URL: ${{ steps.sentry-upload.outputs.SENTRY_URL }}
steps:
- name: Checkout
uses: useblacksmith/checkout@c9796daa2a4bdebdab5bd16be2c09a70cd4e1121 # v1

- name: Upload to Sentry for size analysis
id: sentry-upload
uses: ./.github/actions/composite/uploadSentrySizeAnalysis
env:
GH_TOKEN: ${{ github.token }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
with:
platform: iOS
asset-name: Expensify.ipa
artifact-name: iosBuild-artifact
staging-release-tag: ${{ needs.prep.outputs.TAG }}-staging
is-cherry-pick: ${{ needs.prep.outputs.IS_CHERRY_PICK }}

# Why is this necessary for CP-to-prod? Consider this scenario:
# 1. You close a checklist and we create a new staging version `9.0.34-0` and a new checklist
# 2. You then CP a PR to production, and in the process create `9.0.35-0`
Expand Down Expand Up @@ -1068,13 +1130,13 @@ jobs:
postGithubComments:
uses: ./.github/workflows/postDeployComments.yml
if: ${{ always() && fromJSON(needs.checkDeploymentSuccess.outputs.IS_RELEASE_READY) }}
needs: [prep, checkDeploymentSuccess, createRelease, androidBuild, iosBuild]
needs: [prep, checkDeploymentSuccess, createRelease, androidBuild, iosBuild, androidUploadSentry, iosUploadSentry]
secrets: inherit
with:
version: ${{ needs.prep.outputs.APP_VERSION }}
env: ${{ needs.prep.outputs.DEPLOY_ENV }}
android: ${{ needs.checkDeploymentSuccess.outputs.ANDROID_RESULT }}
ios: ${{ needs.checkDeploymentSuccess.outputs.IOS_RESULT }}
web: ${{ needs.checkDeploymentSuccess.outputs.WEB_RESULT }}
android_sentry_url: ${{ needs.androidBuild.outputs.SENTRY_URL }}
ios_sentry_url: ${{ needs.iosBuild.outputs.SENTRY_URL }}
android_sentry_url: ${{ needs.androidUploadSentry.outputs.SENTRY_URL }}
ios_sentry_url: ${{ needs.iosUploadSentry.outputs.SENTRY_URL }}
Loading