1name: Test Suite 2 3on: 4 workflow_dispatch: {} 5 push: 6 branches: [master, '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 21concurrency: 22 group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} 23 cancel-in-progress: true 24 25jobs: 26 web: 27 runs-on: ubuntu-18.04 28 steps: 29 - name: ⬢ Setup Node 30 uses: actions/setup-node@v2 31 with: 32 node-version: '14.17' 33 - name: Checkout 34 uses: actions/checkout@v2 35 with: 36 submodules: true 37 - name: ♻️ Restore workspace node modules 38 uses: actions/cache@v2 39 id: node-modules-cache 40 with: 41 path: | 42 # See "workspaces" → "packages" in the root package.json for the source of truth of 43 # which node_modules are affected by the root yarn.lock 44 node_modules 45 apps/*/node_modules 46 home/node_modules 47 packages/*/node_modules 48 packages/@unimodules/*/node_modules 49 react-native-lab/react-native/node_modules 50 key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} 51 - name: Install node modules in root dir 52 run: yarn install --frozen-lockfile 53 - run: yarn global add expo-cli 54 - run: yarn test:web 55 working-directory: apps/bare-expo 56 - name: Notify on Slack 57 uses: 8398a7/action-slack@v3 58 if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-')) 59 env: 60 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 61 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_web }} 62 with: 63 channel: '#platform-web' 64 status: ${{ job.status }} 65 fields: job,message,ref,eventName,author,took 66 author_name: Test Suite (Web) 67 68 ios: 69 runs-on: macos-11 70 steps: 71 - name: Checkout 72 uses: actions/checkout@v2 73 with: 74 submodules: true 75 - name: Switch to Xcode 13.0 76 run: sudo xcode-select --switch /Applications/Xcode_13.0.app 77 - name: Install required tools 78 run: | 79 brew tap wix/brew 80 brew install applesimutils 81 brew install watchman 82 echo "$(pwd)/bin" >> $GITHUB_PATH 83 - name: Setup Ruby and install gems 84 uses: ruby/setup-ruby@v1 85 with: 86 bundler-cache: true 87 - name: ♻️ Restore workspace node modules 88 uses: actions/cache@v2 89 id: node-modules-cache 90 with: 91 path: | 92 # See "workspaces" → "packages" in the root package.json for the source of truth of 93 # which node_modules are affected by the root yarn.lock 94 node_modules 95 apps/*/node_modules 96 home/node_modules 97 packages/*/node_modules 98 packages/@unimodules/*/node_modules 99 react-native-lab/react-native/node_modules 100 key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} 101 - name: Install node modules in root dir 102 run: yarn install --frozen-lockfile 103 - name: ♻️ Restore apps/bare-expo/ios/Pods from cache 104 uses: actions/cache@v2 105 id: pods-cache 106 with: 107 path: 'apps/bare-expo/ios/Pods' 108 key: ${{ runner.os }}-bare-expo-pods-${{ hashFiles('apps/bare-expo/ios/Podfile.lock') }} 109 # restore-keys: | 110 # ${{ runner.os }}-bare-expo-pods- 111 - name: ️ Debug CocoaPods lockfiles 112 run: git diff Podfile.lock Pods/Manifest.lock 113 working-directory: apps/bare-expo/ios 114 continue-on-error: true 115 - name: ⚛️ Display React Native config 116 run: yarn react-native config 117 working-directory: apps/bare-expo 118 - name: Display pod environment 119 run: pod env 120 working-directory: apps/bare-expo/ios 121 - name: Install pods in apps/bare-expo/ios 122 run: pod install 123 working-directory: apps/bare-expo/ios 124 - name: Clean Detox 125 run: yarn detox:clean 126 working-directory: apps/bare-expo 127 - name: Build iOS project for Detox 128 run: yarn ios:detox:build:release 129 working-directory: apps/bare-expo 130 timeout-minutes: 30 131 - name: Run tests 132 run: yarn ios:detox:test:release 133 working-directory: apps/bare-expo 134 - name: Store images of build failures 135 if: always() 136 uses: actions/upload-artifact@v2 137 with: 138 name: bare-expo-artifacts 139 path: apps/bare-expo/artifacts 140 - name: Notify on Slack 141 uses: 8398a7/action-slack@v3 142 if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-')) 143 env: 144 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 145 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }} 146 with: 147 channel: '#platform-ios' 148 status: ${{ job.status }} 149 fields: job,message,ref,eventName,author,took 150 author_name: Test Suite (iOS) 151 152 android: 153 runs-on: macos-11 154 env: 155 NDK_ABI_FILTERS: x86_64 156 steps: 157 - name: Checkout 158 uses: actions/checkout@v2 159 with: 160 submodules: true 161 - name: Install required tools 162 run: | 163 brew install watchman 164 echo "$(pwd)/bin" >> $GITHUB_PATH 165 - name: ♻️ Restore workspace node modules 166 uses: actions/cache@v2 167 id: node-modules-cache 168 with: 169 path: | 170 # See "workspaces" → "packages" in the root package.json for the source of truth of 171 # which node_modules are affected by the root yarn.lock 172 node_modules 173 apps/*/node_modules 174 home/node_modules 175 packages/*/node_modules 176 packages/@unimodules/*/node_modules 177 react-native-lab/react-native/node_modules 178 key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} 179 - name: Install node modules in root dir 180 run: yarn install --frozen-lockfile 181 - uses: actions/cache@v2 182 with: 183 path: ~/.gradle/caches 184 key: ${{ runner.os }}-gradle-v20210625-${{ hashFiles('android/*.gradle*') }} 185 restore-keys: | 186 ${{ runner.os }}-gradle-v20210625 187 - name: ⚛️ Display React Native config 188 run: yarn react-native config 189 working-directory: apps/bare-expo 190 - name: Clean Detox 191 run: yarn detox:clean 192 working-directory: apps/bare-expo 193 - name: Patch react-native to support single abi 194 run: sed -i '' 's/^APP_ABI := .*$/APP_ABI := $(if $(NDK_ABI_FILTERS),$(NDK_ABI_FILTERS),$(armeabi-v7a x86 arm64-v8a x86_64))/g' ReactAndroid/src/main/jni/Application.mk 195 working-directory: react-native-lab/react-native 196 - name: Prebuild react-native AAR 197 # Workaround for next `yarn android:detox:build:release` occasionally failed at gradle fetching libraries on GitHub Actions 198 # Just to introduce another trail for gradle building. 199 run: ./gradlew :ReactAndroid:installArchives | true 200 working-directory: react-native-lab/react-native 201 timeout-minutes: 35 202 env: 203 GRADLE_OPTS: '-Dorg.gradle.internal.http.connectionTimeout=180000 -Dorg.gradle.internal.http.socketTimeout=180000 -Dorg.gradle.internal.network.retry.max.attempts=18 -Dorg.gradle.internal.network.retry.initial.backOff=2000' 204 - name: Build Android project for Detox 205 run: yarn android:detox:build:release 206 working-directory: apps/bare-expo 207 timeout-minutes: 35 208 env: 209 GRADLE_OPTS: '-Dorg.gradle.internal.http.connectionTimeout=180000 -Dorg.gradle.internal.http.socketTimeout=180000 -Dorg.gradle.internal.network.retry.max.attempts=18 -Dorg.gradle.internal.network.retry.initial.backOff=2000' 210 - name: Run tests 211 uses: reactivecircus/android-emulator-runner@v2 212 with: 213 api-level: 29 214 arch: x86_64 215 avd-name: bare-expo 216 script: yarn android:detox:test:release 217 working-directory: ./apps/bare-expo 218 - name: Store images of build failures 219 if: always() 220 uses: actions/upload-artifact@v2 221 with: 222 name: bare-expo-artifacts 223 path: apps/bare-expo/artifacts 224 - name: Notify on Slack 225 uses: 8398a7/action-slack@v3 226 if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-')) 227 env: 228 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 229 SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }} 230 with: 231 channel: '#platform-android' 232 status: ${{ job.status }} 233 fields: job,message,ref,eventName,author,took 234 author_name: Test Suite (Android) 235