1name: Test Suite 2 3on: 4 workflow_dispatch: {} 5 push: 6 branches: [main, 'sdk-*'] 7 paths: 8 - .github/workflows/test-suite.yml 9 - apps/bare-expo/** 10 - apps/test-suite/** 11 - packages/** 12 - yarn.lock 13 pull_request: 14 paths: 15 - .github/workflows/test-suite.yml 16 - apps/bare-expo/** 17 - apps/test-suite/** 18 - packages/** 19 - yarn.lock 20 # Ignore Expo CLI for now... 21 - '!packages/@expo/cli/**' 22 23concurrency: 24 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 25 cancel-in-progress: true 26 27jobs: 28 web: 29 runs-on: ubuntu-22.04 30 steps: 31 - name: Checkout 32 uses: actions/checkout@v3 33 with: 34 submodules: true 35 - name: ⬢ Setup Node 36 uses: actions/setup-node@v3 37 with: 38 node-version: 16 39 - name: ♻️ Restore caches 40 uses: ./.github/actions/expo-caches 41 id: expo-caches 42 with: 43 yarn-workspace: 'true' 44 - name: Install node modules in root dir 45 if: steps.expo-caches.outputs.yarn-workspace-hit != 'true' 46 run: yarn install --frozen-lockfile 47 - name: Run Web tests 48 run: yarn test:web 49 working-directory: apps/bare-expo 50 env: 51 EXPO_NO_TYPESCRIPT_SETUP: 1 52 - name: Notify on Slack 53 uses: 8398a7/action-slack@v3 54 if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-')) 55 env: 56 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 57 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_web }} 58 with: 59 channel: '#expo-web' 60 status: ${{ job.status }} 61 fields: job,message,ref,eventName,author,took 62 author_name: Test Suite (Web) 63 64 ios: 65 runs-on: macos-12 66 steps: 67 - name: Checkout 68 uses: actions/checkout@v3 69 with: 70 submodules: true 71 - name: Switch to Xcode 14.1 72 run: sudo xcode-select --switch /Applications/Xcode_14.1.app 73 - name: Install required tools 74 run: | 75 brew tap wix/brew 76 brew install applesimutils 77 brew install watchman 78 - name: ➕ Add `bin` to GITHUB_PATH 79 run: echo "$(pwd)/bin" >> $GITHUB_PATH 80 - name: Setup Ruby and install gems 81 uses: ruby/setup-ruby@v1 82 with: 83 bundler-cache: true 84 - name: ♻️ Restore caches 85 uses: ./.github/actions/expo-caches 86 id: expo-caches 87 with: 88 yarn-workspace: 'true' 89 yarn-tools: 'true' 90 bare-expo-pods: 'true' 91 - name: Install node modules in root dir 92 if: steps.expo-caches.outputs.yarn-workspace-hit != 'true' 93 run: yarn install --frozen-lockfile 94 - name: ️ Debug CocoaPods lockfiles 95 run: git diff Podfile.lock Pods/Manifest.lock 96 working-directory: apps/bare-expo/ios 97 continue-on-error: true 98 - name: ⚛️ Display React Native config 99 run: yarn react-native config 100 working-directory: apps/bare-expo 101 - name: Display pod environment 102 run: pod env 103 working-directory: apps/bare-expo/ios 104 - name: Install pods in apps/bare-expo/ios 105 if: steps.expo-caches.outputs.ios-pods-hit != 'true' 106 run: pod install 107 working-directory: apps/bare-expo/ios 108 - name: Clean Detox 109 run: yarn detox:clean 110 working-directory: apps/bare-expo 111 - name: ️ Build iOS project for Detox 112 run: yarn ios:detox:build:release 113 working-directory: apps/bare-expo 114 timeout-minutes: 30 115 env: 116 EXPO_DEBUG: 1 117 NODE_ENV: production 118 - name: Run tests 119 run: yarn ios:detox:test:release 120 working-directory: apps/bare-expo 121 env: 122 EXPO_DEBUG: 1 123 NODE_ENV: production 124 - name: Store images of build failures 125 if: always() 126 uses: actions/upload-artifact@v3 127 with: 128 name: bare-expo-artifacts 129 path: apps/bare-expo/artifacts 130 - name: Notify on Slack 131 uses: 8398a7/action-slack@v3 132 if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-')) 133 env: 134 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 135 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }} 136 with: 137 channel: '#expo-ios' 138 status: ${{ job.status }} 139 fields: job,message,ref,eventName,author,took 140 author_name: Test Suite (iOS) 141 142 android-build: 143 runs-on: ubuntu-22.04 144 env: 145 ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64 146 GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4096m -XX:MaxMetaspaceSize=4096m" 147 steps: 148 - name: Checkout 149 uses: actions/checkout@v3 150 with: 151 submodules: true 152 - name: ⬢ Setup Node 153 uses: actions/setup-node@v3 154 with: 155 node-version: 16 156 - name: Use JDK 11 157 uses: actions/setup-java@v3 158 with: 159 distribution: 'temurin' 160 java-version: '11' 161 - name: ➕ Add `bin` to GITHUB_PATH 162 run: echo "$(pwd)/bin" >> $GITHUB_PATH 163 - name: ♻️ Restore caches 164 uses: ./.github/actions/expo-caches 165 id: expo-caches 166 with: 167 gradle: 'true' 168 yarn-workspace: 'true' 169 yarn-tools: 'true' 170 react-native-gradle-downloads: 'true' 171 - name: Install workspace node modules 172 if: steps.expo-caches.outputs.yarn-workspace-hit != 'true' 173 run: yarn install --frozen-lockfile 174 - name: ⚛️ Display React Native config 175 run: yarn react-native config 176 working-directory: apps/bare-expo 177 - name: ️ Generate dynamic macros 178 run: expotools android-generate-dynamic-macros --configuration release --bare 179 - name: ️ Build Android project 180 run: ./gradlew -DtestBuildType=release :app:assembleRelease :app:assembleAndroidTest --no-daemon 181 working-directory: apps/bare-expo/android 182 timeout-minutes: 35 183 env: 184 EXPO_DEBUG: 1 185 NODE_ENV: production 186 - name: Upload builds 187 uses: actions/upload-artifact@v3 188 with: 189 name: bare-expo-android-builds 190 path: apps/bare-expo/android/app/build/outputs/apk 191 - name: Notify on Slack 192 uses: 8398a7/action-slack@v3 193 if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-')) 194 env: 195 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 196 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }} 197 MATRIX_CONTEXT: ${{ toJson(matrix) }} 198 with: 199 channel: '#expo-android' 200 status: ${{ job.status }} 201 fields: job,message,ref,eventName,author,took 202 author_name: Test Suite (Android) 203 204 android-test: 205 needs: android-build 206 runs-on: macos-12 207 strategy: 208 matrix: 209 api-level: [33] 210 steps: 211 - name: Checkout 212 uses: actions/checkout@v3 213 - name: Download builds 214 uses: actions/download-artifact@v3 215 with: 216 name: bare-expo-android-builds 217 path: apps/bare-expo/android/app/build/outputs/apk 218 - name: Run tests 219 uses: ./.github/actions/use-android-emulator 220 with: 221 avd-api: ${{ matrix.api-level }} 222 avd-name: avd-${{ matrix.api-level }} 223 script: | 224 mkdir artifacts || true 225 adb logcat -d > artifacts/emulator.log 226 adb logcat -c || true 227 adb shell screencap -p /data/local/tmp/bareexpo.png && adb pull /data/local/tmp/bareexpo.png artifacts/beforeTests.png 228 ./scripts/start-android-e2e-test.sh 229 adb shell screencap -p /data/local/tmp/bareexpo.png && adb pull /data/local/tmp/bareexpo.png artifacts/afterTests.png 230 adb logcat -d > artifacts/adb.log 231 working-directory: ./apps/bare-expo 232 - name: Store images of test failures 233 if: always() 234 uses: actions/upload-artifact@v3 235 with: 236 name: bare-expo-artifacts 237 path: apps/bare-expo/artifacts 238 - name: Notify on Slack 239 uses: 8398a7/action-slack@v3 240 if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-')) 241 env: 242 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 243 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }} 244 MATRIX_CONTEXT: ${{ toJson(matrix) }} 245 with: 246 channel: '#expo-android' 247 status: ${{ job.status }} 248 fields: job,message,ref,eventName,author,took 249 author_name: Test Suite (Android) 250