Integrating Into CI
Set up the integration in CI to receive automated size change notifications
The GitHub integration brings Size Analysis directly into your pull request workflow by adding status checks. This alerts developers to the size impact their code changes have on the app build, and can optionally block the pull request from being merged on large size increases.
Size Analysis works by comparing a head vs a base build, similar to how code review compares your new code to the baseline code.
Install the Sentry Github App by following the installation instructions in the GitHub integration documentation.
a. If you have previously installed the Sentry App, ensure you have accepted the latest permissions in order to receive Status Checks.
Set up Size Analysis by following the guide for iOS or Android.
Modify an existing workflow or create a new workflow to upload base builds from your main or default branch to Sentry:
Release builds
We recommend uploading Release builds in CI since they are representative of what your end users see and provide cleaner diffs.
sentry_size_analysis_main.ymlname: Sentry Size Analysis Upload
on:
push:
branches: [main]
jobs:
build_and_upload: // Add your upload command here from the respective iOS or Android guide
Example workflows:
- Android main branch workflow - Handles both push to main and pull requests in a single workflow
- iOS main branch workflow - Separate workflow for main branch
Confirm that builds uploaded from this workflow have the correct sha metadata value, as well as no base_sha being set.
- Modify an existing workflow or create a new workflow to upload head builds from your pull request branches:
sentry_size_analysis_pull_request.ymlname: Sentry Size Analysis Upload
on:
pull_request:
branches: [main]
jobs:
build_and_upload: // Add your upload command here from the respective iOS or Android guide
Example workflows:
- Android pull request workflow - Combined main and PR workflow
- iOS pull request workflow - Separate PR workflow
Confirm that builds uploaded from this workflow have the correct sha and base_sha metadata values.
- Confirm the status check appears
After configuring both workflows and sending the correct metadata, the status check should appear on every commit:
- View the detailed breakdown
Clicking on the "Details" button above should bring you to a more detailed breakdown of the changes.
Check that:
- The Sentry GitHub App is installed and has access to your repository
- You're correctly uploading builds for size analysis from all base branch builds
- You're correctly uploading builds for size analysis from the PR branch.
- Your builds that you want to compare have the same build configuration (for example, both are
Releasebuilds) - Your builds contain all the required metadata
The first time you set up Size Analysis, your main branch may not have any builds yet:
- Merge a PR or push to your main branch to trigger a build
- Future PRs will be able to compare against this base build
This could be due to a few things:
- The wrong base build is being selected. Check that the Git information in both head/base builds match what you expect for your pull request.
- The compiler optimized code in a different way. The analysis is being performed on the compiled output of the app, and sometimes the compiler can optimize code in slightly different ways depending on your code changes, for example with function outlining.
- The build environment is different between head/base builds. For iOS analyses, make sure the same version of Xcode is being used for both the builds.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").