|
| 1 | +name: Sample Application Expo |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - v5 |
| 8 | + pull_request: |
| 9 | + |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 12 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 13 | + |
| 14 | +env: |
| 15 | + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} |
| 16 | + RN_SENTRY_POD_NAME: RNSentry |
| 17 | + |
| 18 | +jobs: |
| 19 | + diff_check: |
| 20 | + uses: ./.github/workflows/skip-ci.yml |
| 21 | + |
| 22 | + build: |
| 23 | + name: Build ${{ matrix.platform }} ${{ matrix.build-type }} ${{ matrix.ios-use-frameworks}} |
| 24 | + runs-on: ${{ matrix.runs-on }} |
| 25 | + needs: [diff_check] |
| 26 | + if: ${{ needs.diff_check.outputs.skip_ci != 'true' }} |
| 27 | + env: |
| 28 | + SENTRY_DISABLE_AUTO_UPLOAD: 'true' |
| 29 | + strategy: |
| 30 | + # we want that the matrix keeps running, default is to cancel them if it fails. |
| 31 | + fail-fast: false |
| 32 | + matrix: |
| 33 | + ios-use-frameworks: ['no-frameworks', 'dynamic-frameworks'] |
| 34 | + platform: ['android', 'ios'] |
| 35 | + build-type: ['dev', 'production'] |
| 36 | + include: |
| 37 | + - platform: ios |
| 38 | + runs-on: macos-15 |
| 39 | + - platform: android |
| 40 | + runs-on: ubuntu-latest |
| 41 | + - platform: web |
| 42 | + runs-on: ubuntu-latest |
| 43 | + exclude: |
| 44 | + - platform: 'android' |
| 45 | + ios-use-frameworks: 'dynamic-frameworks' |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v4 |
| 48 | + |
| 49 | + - name: Enable Corepack |
| 50 | + run: | |
| 51 | + |
| 52 | + corepack enable |
| 53 | + - uses: actions/setup-node@v4 |
| 54 | + with: |
| 55 | + node-version: 18 |
| 56 | + cache: 'yarn' |
| 57 | + cache-dependency-path: yarn.lock |
| 58 | + |
| 59 | + - uses: ruby/setup-ruby@v1 |
| 60 | + if: ${{ matrix.platform == 'ios' }} |
| 61 | + with: |
| 62 | + working-directory: ${{ matrix.platform == 'ios' && ' samples/expo' }} |
| 63 | + ruby-version: '3.3.0' # based on what is used in the sample |
| 64 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 65 | + cache-version: 1 # cache the installed gems |
| 66 | + |
| 67 | + - uses: actions/setup-java@v4 |
| 68 | + with: |
| 69 | + java-version: '17' |
| 70 | + distribution: 'adopt' |
| 71 | + |
| 72 | + - name: Gradle cache |
| 73 | + uses: gradle/gradle-build-action@ac2d340dc04d9e1113182899e983b5400c17cda1 # v3.5.0 |
| 74 | + |
| 75 | + - name: Setup Global Xcode Tools |
| 76 | + if: ${{ matrix.platform == 'ios' }} |
| 77 | + run: which xcbeautify || brew install xcbeautify |
| 78 | + |
| 79 | + - name: Install SDK Dependencies |
| 80 | + run: yarn install |
| 81 | + |
| 82 | + - name: Build SDK |
| 83 | + run: yarn build |
| 84 | + |
| 85 | + - name: Prebuild apps |
| 86 | + if: ${{ matrix.platform == 'android' || matrix.platform == 'ios' }} |
| 87 | + working-directory: samples/expo |
| 88 | + run: npx expo prebuild |
| 89 | + |
| 90 | + - name: Install App Pods |
| 91 | + if: ${{ matrix.platform == 'ios' }} |
| 92 | + working-directory: samples/expo/ios |
| 93 | + run: | |
| 94 | + [[ "${{ matrix.build-type }}" == "production" ]] && ENABLE_PROD=1 || ENABLE_PROD=0 |
| 95 | + [[ "${{ matrix.ios-use-frameworks }}" == "dynamic-frameworks" ]] && export USE_FRAMEWORKS=dynamic |
| 96 | + echo "ENABLE_PROD=$ENABLE_PROD" |
| 97 | + PRODUCTION=$ENABLE_PROD pod install |
| 98 | + cat Podfile.lock | grep $RN_SENTRY_POD_NAME |
| 99 | +
|
| 100 | + - name: Build Android App |
| 101 | + if: ${{ matrix.platform == 'android' }} |
| 102 | + working-directory: samples/expo/android |
| 103 | + run: | |
| 104 | + [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug' |
| 105 | + echo "Building $CONFIG" |
| 106 | + ./gradlew ":app:assemble$CONFIG" -PreactNativeArchitectures=x86 |
| 107 | +
|
| 108 | + - name: Build iOS App |
| 109 | + if: ${{ matrix.platform == 'ios' }} |
| 110 | + working-directory: samples/expo/ios |
| 111 | + run: | |
| 112 | + [[ "${{ matrix.build-type }}" == "production" ]] && CONFIG='Release' || CONFIG='Debug' |
| 113 | + echo "Building $CONFIG" |
| 114 | + mkdir -p "DerivedData" |
| 115 | + derivedData="$(cd "DerivedData" ; pwd -P)" |
| 116 | + set -o pipefail && xcodebuild \ |
| 117 | + -workspace sentryreactnativeexposample.xcworkspace \ |
| 118 | + -configuration "$CONFIG" \ |
| 119 | + -scheme sentryreactnativeexposample \ |
| 120 | + -sdk 'iphonesimulator' \ |
| 121 | + -destination 'generic/platform=iOS Simulator' \ |
| 122 | + ONLY_ACTIVE_ARCH=yes \ |
| 123 | + -derivedDataPath "$derivedData" \ |
| 124 | + build \ |
| 125 | + | tee xcodebuild.log \ |
| 126 | + | xcbeautify --quieter --is-ci --disable-colored-output |
| 127 | +
|
| 128 | + - name: Build Web App |
| 129 | + if: ${{ matrix.platform == 'web' }} |
| 130 | + working-directory: samples/expo |
| 131 | + run: | |
| 132 | + npx expo export -p web |
| 133 | +
|
| 134 | + - name: Upload logs |
| 135 | + if: ${{ always() }} |
| 136 | + uses: actions/upload-artifact@v4 |
| 137 | + with: |
| 138 | + name: build-sample-expo-${{ matrix.platform }}-${{ matrix.build-type }}-${{ matrix.ios-use-frameworks}}-logs |
| 139 | + path: samples/expo/${{ matrix.platform }}/*.log |
0 commit comments