|
| 1 | +name: sdk/react-native/example |
| 2 | + |
| 3 | +# The example builds independently of react-native because of the duration of the build. |
| 4 | +# We limit it to only build under specific circumstances. |
| 5 | +# Additionally this does allow for scheduled builds of just the example, to handle changes in expo, |
| 6 | +# should they be desired. |
| 7 | + |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [main, 'feat/**'] |
| 11 | + paths-ignore: |
| 12 | + - '**.md' #Do not need to run CI for markdown changes. |
| 13 | + pull_request: |
| 14 | + branches: [main, 'feat/**'] |
| 15 | + paths: |
| 16 | + - 'packages/shared/common/**' |
| 17 | + - 'packages/shared/sdk-client/**' |
| 18 | + - 'packages/sdk/react-native/**' |
| 19 | + - 'packages/shared/mocks/**' |
| 20 | + |
| 21 | +jobs: |
| 22 | + detox-android: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + permissions: |
| 25 | + id-token: write |
| 26 | + contents: read |
| 27 | + defaults: |
| 28 | + run: |
| 29 | + working-directory: packages/sdk/react-native/example |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Setup Node.js |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + |
| 36 | + - name: Install deps |
| 37 | + run: yarn workspaces focus |
| 38 | + - name: Build |
| 39 | + run: yarn workspaces foreach -pR --topological-dev --from 'react-native-example' run build |
| 40 | + |
| 41 | + - uses: ./actions/release-secrets |
| 42 | + name: 'Get mobile key' |
| 43 | + with: |
| 44 | + aws_assume_role: ${{ vars.AWS_ROLE_ARN_EXAMPLES }} |
| 45 | + ssm_parameter_pairs: '/sdk/common/hello-apps/mobile-key = MOBILE_KEY, |
| 46 | + /sdk/common/hello-apps/boolean-flag-key = LAUNCHDARKLY_FLAG_KEY' |
| 47 | + |
| 48 | + - name: Create .env file. |
| 49 | + run: echo "MOBILE_KEY=$MOBILE_KEY" > .env |
| 50 | + |
| 51 | + - name: Enable KVM group perms (for performance) |
| 52 | + run: | |
| 53 | + echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 54 | + sudo udevadm control --reload-rules |
| 55 | + sudo udevadm trigger --name-match=kvm |
| 56 | +
|
| 57 | + - name: Expo Prebuild |
| 58 | + run: npx expo prebuild |
| 59 | + |
| 60 | + # Java setup is after checkout and expo prebuild so that it can locate the |
| 61 | + # gradle configuration. |
| 62 | + - name: Setup Java |
| 63 | + uses: actions/setup-java@v4 |
| 64 | + with: |
| 65 | + distribution: temurin |
| 66 | + java-version: 17 |
| 67 | + cache: 'gradle' |
| 68 | + |
| 69 | + - name: Detox build |
| 70 | + run: yarn detox build --configuration android.emu.release |
| 71 | + |
| 72 | + - name: Get android emulator device name |
| 73 | + id: device |
| 74 | + run: node -e "console.log('AVD_NAME=' + require('./.detoxrc').devices.emulator.device.avdName)" >> $GITHUB_OUTPUT |
| 75 | + |
| 76 | + - name: Make space for the emulator. |
| 77 | + uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be |
| 78 | + with: |
| 79 | + android: false # We need android. |
| 80 | + |
| 81 | + - name: Detox test |
| 82 | + uses: reactivecircus/android-emulator-runner@f0d1ed2dcad93c7479e8b2f2226c83af54494915 |
| 83 | + with: |
| 84 | + api-level: 31 |
| 85 | + arch: x86_64 |
| 86 | + avd-name: ${{ steps.device.outputs.AVD_NAME }} |
| 87 | + working-directory: packages/sdk/react-native/example |
| 88 | + script: yarn detox test --configuration android.emu.release --headless --record-logs all |
| 89 | + |
| 90 | + - name: Upload artifacts |
| 91 | + if: always() |
| 92 | + uses: actions/upload-artifact@v4 |
| 93 | + with: |
| 94 | + name: detox-artifacts |
| 95 | + path: packages/sdk/react-native/example/artifacts |
0 commit comments