Skip to content

[DNM] test upload

[DNM] test upload #24

name: Sentry PR iOS Upload (Size Analysis)
on:
pull_request:
branches: [main]
paths: [ios/**, .github/workflows/ios_sentry_upload_pr.yml]
jobs:
build:
runs-on: macos-15
defaults:
run:
working-directory: ./ios
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: test
run: echo $(git merge-base --fork-point ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }})"
- name: Select Xcode version
run: sudo xcode-select -s '/Applications/Xcode_16.4.app/Contents/Developer'
- name: Set up Ruby env
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
bundler-cache: true
- name: Install Sentry CLI
run: |
curl -L -o sentry-cli https://github.com/getsentry/sentry-cli/releases/download/2.53.0-alpha/sentry-cli-Darwin-universal
chmod +x sentry-cli
sudo mv sentry-cli /usr/local/bin/
- name: Setup gems
run: exec ../.github/scripts/ios/setup.sh
- name: Decode signing certificate into a file
env:
CERTIFICATE_BASE64: ${{ secrets.IOS_DIST_SIGNING_KEY_BASE64 }}
run: |
echo $CERTIFICATE_BASE64 | base64 --decode > signing-cert.p12
- name: Build XCArchive
run: bundle exec fastlane ios build_only
env:
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY: ${{ secrets.ASC_PRIVATE_KEY }}
SIGNING_KEY_PASSWORD: ${{ secrets.IOS_DIST_SIGNING_KEY_PASSWORD }}
SIGNING_KEY_FILE_PATH: signing-cert.p12
EMERGE_API_TOKEN: ${{ secrets.EMERGE_API_KEY }}
CONFIGURATION: Release
EMERGE_BUILD_TYPE: pull-request
- name: Strip asset catalogs from XCArchive
run: |
echo "Finding and thinning asset catalogs in XCArchive..."
XCARCHIVE_PATH='./build/HackerNews.xcarchive'
# Check if XCArchive exists
if [ ! -d "$XCARCHIVE_PATH" ]; then
echo "Error: XCArchive not found at $XCARCHIVE_PATH"
exit 1
fi
# Look for asset catalogs in the Products directory
find "$XCARCHIVE_PATH" -name "*.car" -type f | while read -r car_file; do
echo "Found asset catalog: $car_file"
# Create backup of original
cp "$car_file" "${car_file}.backup"
# Thin the asset catalog using assetutil
assetutil -i "phone" -s "3" -p "P3" -M "4" -g "MTL6,1" -r "13.0" "$car_file" -o "$car_file"
if [ $? -eq 0 ]; then
echo "Successfully thinned: $car_file"
rm "${car_file}.backup"
else
echo "Failed to thin: $car_file, restoring backup"
mv "${car_file}.backup" "$car_file"
fi
done
- name: Upload iOS size analysis binary to Sentry
run: |
sentry-cli \
--log-level=debug \
--auth-token ${{ secrets.SENTRY_SENTRY_AUTH_TOKEN }} \
build \
upload \
./build/HackerNews.xcarchive \
--org sentry \
--project launchpad-test-ios \
--head-sha ${{ github.event.pull_request.head.sha }} \
--base-sha ${{ github.event.pull_request.base.sha }} \
--vcs-provider github \
--head-repo-name ${{ github.repository }} \
--base-repo-name ${{ github.repository }} \
--head-ref ${{ github.head_ref }} \
--base-ref ${{ github.base_ref }} \
--pr-number ${{ github.event.number }} \
--build-configuration Release