|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + android: |
| 12 | + name: Android |
| 13 | + runs-on: ubuntu-latest |
| 14 | + env: |
| 15 | + TURBO_CACHE_DIR: .turbo/android |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + submodules: 'true' |
| 22 | + |
| 23 | + - name: Generate |
| 24 | + uses: ./.github/actions/generate |
| 25 | + with: |
| 26 | + platform: android |
| 27 | + release: true # Some android target fails to compile in debug due to unstable panic_immediate_abort option |
| 28 | + |
| 29 | + - name: Cache turborepo for Android |
| 30 | + uses: actions/cache@v4 |
| 31 | + with: |
| 32 | + path: ${{ env.TURBO_CACHE_DIR }} |
| 33 | + key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} |
| 34 | + restore-keys: | |
| 35 | + ${{ runner.os }}-turborepo-android- |
| 36 | +
|
| 37 | + - name: Check turborepo cache for Android |
| 38 | + run: | |
| 39 | + TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") |
| 40 | +
|
| 41 | + if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then |
| 42 | + echo "turbo_cache_hit=1" >> $GITHUB_ENV |
| 43 | + fi |
| 44 | +
|
| 45 | + - name: Install JDK |
| 46 | + if: env.turbo_cache_hit != 1 |
| 47 | + uses: actions/setup-java@v3 |
| 48 | + with: |
| 49 | + distribution: 'zulu' |
| 50 | + java-version: '17' |
| 51 | + |
| 52 | + - name: Finalize Android SDK |
| 53 | + if: env.turbo_cache_hit != 1 |
| 54 | + run: | |
| 55 | + /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" |
| 56 | +
|
| 57 | + - name: Cache Gradle |
| 58 | + if: env.turbo_cache_hit != 1 |
| 59 | + uses: actions/cache@v4 |
| 60 | + with: |
| 61 | + path: | |
| 62 | + ~/.gradle/wrapper |
| 63 | + ~/.gradle/caches |
| 64 | + key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} |
| 65 | + restore-keys: | |
| 66 | + ${{ runner.os }}-gradle- |
| 67 | +
|
| 68 | + - name: Build example for Android |
| 69 | + env: |
| 70 | + JAVA_OPTS: "-XX:MaxHeapSize=6g" |
| 71 | + run: | |
| 72 | + yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" |
| 73 | +
|
| 74 | + ios: |
| 75 | + name: iOS |
| 76 | + runs-on: macos-14 |
| 77 | + env: |
| 78 | + TURBO_CACHE_DIR: .turbo/ios |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Checkout |
| 82 | + uses: actions/checkout@v4 |
| 83 | + with: |
| 84 | + submodules: 'true' |
| 85 | + |
| 86 | + - name: Generate |
| 87 | + uses: ./.github/actions/generate |
| 88 | + with: |
| 89 | + platform: ios |
| 90 | + release: false |
| 91 | + |
| 92 | + - name: Cache turborepo for iOS |
| 93 | + uses: actions/cache@v4 |
| 94 | + with: |
| 95 | + path: ${{ env.TURBO_CACHE_DIR }} |
| 96 | + key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }} |
| 97 | + restore-keys: | |
| 98 | + ${{ runner.os }}-turborepo-ios- |
| 99 | +
|
| 100 | + - name: Check turborepo cache for iOS |
| 101 | + run: | |
| 102 | + TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") |
| 103 | +
|
| 104 | + if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then |
| 105 | + echo "turbo_cache_hit=1" >> $GITHUB_ENV |
| 106 | + fi |
| 107 | +
|
| 108 | + - name: Cache cocoapods |
| 109 | + if: env.turbo_cache_hit != 1 |
| 110 | + id: cocoapods-cache |
| 111 | + uses: actions/cache@v4 |
| 112 | + with: |
| 113 | + path: | |
| 114 | + **/ios/Pods |
| 115 | + key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }} |
| 116 | + restore-keys: | |
| 117 | + ${{ runner.os }}-cocoapods- |
| 118 | +
|
| 119 | + - name: Install cocoapods |
| 120 | + if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' |
| 121 | + run: | |
| 122 | + cd example/ios |
| 123 | +
|
| 124 | + # Work around '[!] CocoaPods could not find compatible versions for pod "hermes-engine"' |
| 125 | + pod update hermes-engine --no-repo-update |
| 126 | +
|
| 127 | + pod install |
| 128 | + env: |
| 129 | + NO_FLIPPER: 1 |
| 130 | + |
| 131 | + - name: Build example for iOS |
| 132 | + run: | |
| 133 | + yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" |
0 commit comments