Skip to content

Commit

Permalink
feat(sentry): enable in android lane
Browse files Browse the repository at this point in the history
  • Loading branch information
lpezzolla committed Sep 21, 2023
1 parent 2c31575 commit e269eca
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 18 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
outputs:
version: ${{ steps.configure.outputs.version }}
build_no: ${{ steps.configure.outputs.build_no }}
build_piece: ${{ steps.configure.outputs.build_piece }}
push_to_testflight: ${{ steps.configure.outputs.push_to_testflight }}
push_to_playstore: ${{ steps.configure.outputs.push_to_playstore }}
steps:
Expand Down Expand Up @@ -111,11 +112,12 @@ jobs:
BUILD_NO=$(( MAJOR*1000000 + MINOR*10000 + SUBV*100 + BUILD_PIECE ))
echo "build_no=$BUILD_NO" >> $GITHUB_OUTPUT
echo "version=$MAJOR.$MINOR.$SUBV" >> $GITHUB_OUTPUT
echo "build_piece=$BUILD_PIECE" >> $GITHUB_OUTPUT
elif [[ "$VERSION" != "" ]]; then
echo "INVALID VERSION FORMAT: $VERSION"
exit 2
fi
echo "push_to_playstore=$PUSH_PLAYSTORE" >> $GITHUB_OUTPUT
echo "push_to_testflight=$PUSH_TESTFLIGHT" >> $GITHUB_OUTPUT
echo "CONFIGURED:"
Expand Down Expand Up @@ -144,7 +146,6 @@ jobs:
dist: ${{ steps.configure.outputs.build_no }}
version: ${{ steps.configure.outputs.version }}


build-android:
name: ${{ needs.configure.outputs.push_to_playstore == 'false' && 'Build' || 'Build & Deploy' }} Android
needs: configure
Expand All @@ -153,13 +154,18 @@ jobs:
LANG: en_US.UTF-8
CI: 'true'
BUILD_NO: ${{ needs.configure.outputs.build_no }}
BUILD_PIECE: ${{ needs.configure.outputs.build_piece }}
APP_VERSION: ${{ needs.configure.outputs.version }}
SUPPLY_GOOGLE_JSON_PATH: './pc-api-secret.json'
KEYSTORE_PW: ${{ secrets.ANDROID_KEYSTORE_PW }}
KEYSTORE_PATH: './keystore.jks'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set .env
run:
echo "APP_VERSION=${{ needs.configure.outputs.version }}" >> .env
echo "APP_BUILD=${{ needs.configure.outputs.build_piece }}" >> .env
- name: Gradle Wrapper Validation
uses: gradle/wrapper-validation-action@v1
- name: Setup Ruby
Expand Down Expand Up @@ -230,6 +236,7 @@ jobs:
LANG: en_US.UTF-8
CI: 'true'
BUILD_NO: ${{ needs.configure.outputs.build_no }}
BUILD_PIECE: ${{ needs.configure.outputs.build_piece }}
APP_VERSION: ${{ needs.configure.outputs.version }}
MATCH_PASSWORD: ${{ secrets.FASTLANE_MATCH_KEY }}
MATCH_GIT_PRIVATE_KEY: "./github_access.pk"
Expand All @@ -245,6 +252,10 @@ jobs:
xcode-version: '14'
- name: Checkout
uses: actions/checkout@v3
- name: Set .env
run:
echo "APP_VERSION=${{ needs.configure.outputs.version }}" >> .env
echo "APP_BUILD=${{ needs.configure.outputs.build_piece }}" >> .env
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
7 changes: 0 additions & 7 deletions .sentryclirc

This file was deleted.

2 changes: 1 addition & 1 deletion android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ platform :android do
org_slug: ENV['SENTRY_ORG'],
project_slug: ENV['SENTRY_PROJECT'],
version: ENV['APP_VERSION'],
build: ENV['BUILD_NO'],
build: ENV['BUILD_PIECE'],
sourcemap: [bundle_path, source_map_path],
rewrite: true
)
Expand Down
2 changes: 2 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
declare module '@env' {
export const API_BASE_PATH: string;
export const APP_VERSION: string;
export const APP_BUILD: string;
}
15 changes: 15 additions & 0 deletions ios/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ platform :ios do
apple_id: "6443913305",
)

source_map_path = 'dist/main.jsbundle.map'
bundle_path = 'dist/main.jsbundle'

sentry_upload_sourcemap(
auth_token: ENV['SENTRY_AUTH_TOKEN'],
org_slug: ENV['SENTRY_ORG'],
project_slug: ENV['SENTRY_PROJECT'],
version: ENV['APP_VERSION'],
build: ENV['BUILD_NO'],
sourcemap: [bundle_path, source_map_path],
rewrite: true
)



end

lane :verify do
Expand Down
4 changes: 0 additions & 4 deletions ios/sentry.properties

This file was deleted.

7 changes: 3 additions & 4 deletions src/utils/sentry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import DeviceInfo from 'react-native-device-info';

import { APP_BUILD, APP_VERSION } from '@env';
import * as Sentry from '@sentry/react-native';

export const routingInstrumentation =
Expand All @@ -14,8 +13,8 @@ export const initSentry = () => {
routingInstrumentation,
}),
],
dist: DeviceInfo.getBuildNumber(),
release: DeviceInfo.getVersion(),
release: `it.polito.students@${APP_VERSION}`,
dist: APP_BUILD,
environment: process.env.NODE_ENV,
tracesSampleRate: 1.0,
});
Expand Down

0 comments on commit e269eca

Please sign in to comment.