1name: Android Client 2 3on: 4 workflow_dispatch: 5 schedule: 6 - cron: '20 5 * * 1,3,5' # 5:20 AM UTC time on every Monday, Wednesday and Friday 7 pull_request: 8 paths: 9 - .github/workflows/client-android.yml 10 - secrets/** 11 - android/** 12 - fastlane/** 13 - Gemfile.lock 14 - yarn.lock 15 push: 16 branches: [main, sdk-*] 17 paths: 18 - .github/workflows/client-android.yml 19 - secrets/** 20 - android/** 21 - fastlane/** 22 - Gemfile.lock 23 - yarn.lock 24 25concurrency: 26 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 27 cancel-in-progress: true 28 29jobs: 30 build: 31 # NOTE(kudo): [macos-temp] Temporarily use macos runner because the limited resource on linux runners does not allow to build Expo Go 32 # runs-on: ubuntu-22.04 33 runs-on: macos-13 34 env: 35 ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64 36 # [macos-temp] Increase JVM memory because macOS runners have more memory available 37 # GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -XX:MaxMetaspaceSize=1024m" 38 GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=4096m" 39 steps: 40 - name: Checkout 41 uses: actions/checkout@v3 42 with: 43 submodules: true 44 # [macos-temp] 45 # - name: Cleanup GitHub Linux runner disk space 46 # uses: ./.github/actions/cleanup-linux-disk-space 47 - name: Use JDK 11 48 uses: actions/setup-java@v3 49 with: 50 distribution: 'temurin' 51 java-version: '11' 52 - name: Setup Ruby and install gems 53 uses: ruby/setup-ruby@v1 54 with: 55 bundler-cache: true 56 ruby-version: 3.2.2 57 - name: ♻️ Restore caches 58 uses: ./.github/actions/expo-caches 59 id: expo-caches 60 with: 61 yarn-workspace: 'true' 62 yarn-tools: 'true' 63 gradle: 'true' 64 hermes-engine-aar: 'true' 65 react-native-gradle-downloads: 'true' 66 - name: ➕ Add `bin` to GITHUB_PATH 67 run: echo "$(pwd)/bin" >> $GITHUB_PATH 68 - name: Yarn install 69 if: steps.expo-caches.outputs.yarn-workspace-hit != 'true' 70 run: yarn install --frozen-lockfile 71 - name: Decrypt secrets if possible 72 uses: ./.github/actions/expo-git-decrypt 73 with: 74 key: ${{ secrets.GIT_CRYPT_KEY_BASE64 }} 75 - name: Check which flavor to build 76 id: flavor 77 uses: dorny/paths-filter@v2 78 with: 79 # this action fails when base is not set on schedule event 80 base: ${{ github.ref }} 81 filters: | 82 versioned: 83 - android/versioned-abis/** 84 - android/versioned-react-native/** 85 - android/expoview/src/versioned/** 86 - android/expoview/src/main/java/versioned/** 87 - android/**/*.gradle 88 - name: Build APK 89 env: 90 IS_VERSIONED_FLAVOR: ${{ github.event_name == 'schedule' || steps.flavor.outputs.versioned == 'true' }} 91 BUILD_TYPE: Debug 92 run: | 93 [[ "$IS_VERSIONED_FLAVOR" == "true" ]] && FLAVOR="Versioned" || FLAVOR="Unversioned" 94 echo "Building: flavor[${FLAVOR}] type[${BUILD_TYPE}]" 95 fastlane android build build_type:$BUILD_TYPE flavor:$FLAVOR sign:false 96 - name: Upload APK artifact 97 uses: actions/upload-artifact@v3 98 with: 99 name: android-apk 100 path: android/app/build/outputs/apk 101 - name: Store daemon logs for debugging crashes 102 if: failure() 103 uses: actions/upload-artifact@v3 104 with: 105 name: gradle-daemon-logs 106 path: ~/.gradle/daemon 107 - name: Notify on Slack 108 uses: 8398a7/action-slack@v3 109 if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-')) 110 env: 111 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 112 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }} 113 with: 114 channel: '#expo-android' 115 status: ${{ job.status }} 116 fields: job,message,ref,eventName,author,took 117 author_name: Expo Go (Android) 118