xref: /expo/.github/workflows/test-suite.yml (revision c615fa2e)
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-20.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: �� Install Expo CLI
48        run: yarn global add expo-cli
49      - name: �� Run Web tests
50        run: yarn test:web
51        working-directory: apps/bare-expo
52        env:
53          EXPO_NO_TYPESCRIPT_SETUP: 1
54      - name: �� Notify on Slack
55        uses: 8398a7/action-slack@v3
56        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
57        env:
58          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_web }}
60        with:
61          channel: '#expo-web'
62          status: ${{ job.status }}
63          fields: job,message,ref,eventName,author,took
64          author_name: Test Suite (Web)
65
66  ios:
67    runs-on: macos-12
68    steps:
69      - name: �� Checkout
70        uses: actions/checkout@v3
71        with:
72          submodules: true
73      - name: �� Switch to Xcode 14.1
74        run: sudo xcode-select --switch /Applications/Xcode_14.1.app
75      - name: �� Install required tools
76        run: |
77          brew tap wix/brew
78          brew install applesimutils
79          brew install watchman
80      - name: ➕ Add `bin` to GITHUB_PATH
81        run: echo "$(pwd)/bin" >> $GITHUB_PATH
82      - name: �� Setup Ruby and install gems
83        uses: ruby/setup-ruby@v1
84        with:
85          bundler-cache: true
86      - name: ♻️ Restore caches
87        uses: ./.github/actions/expo-caches
88        id: expo-caches
89        with:
90          yarn-workspace: 'true'
91          yarn-tools: 'true'
92          bare-expo-pods: 'true'
93      - name: �� Install node modules in root dir
94        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
95        run: yarn install --frozen-lockfile
96      - name: ��️ Debug CocoaPods lockfiles
97        run: git diff Podfile.lock Pods/Manifest.lock
98        working-directory: apps/bare-expo/ios
99        continue-on-error: true
100      - name: ⚛️ Display React Native config
101        run: yarn react-native config
102        working-directory: apps/bare-expo
103      - name: �� Display pod environment
104        run: pod env
105        working-directory: apps/bare-expo/ios
106      - name: �� Install pods in apps/bare-expo/ios
107        if: steps.expo-caches.outputs.ios-pods-hit != 'true'
108        run: pod install
109        working-directory: apps/bare-expo/ios
110      - name: �� Clean Detox
111        run: yarn detox:clean
112        working-directory: apps/bare-expo
113      - name: ��️ Build iOS project for Detox
114        run: yarn ios:detox:build:release
115        working-directory: apps/bare-expo
116        timeout-minutes: 30
117      - name: Run tests
118        run: yarn ios:detox:test:release
119        working-directory: apps/bare-expo
120      - name: Store images of build failures
121        if: always()
122        uses: actions/upload-artifact@v3
123        with:
124          name: bare-expo-artifacts
125          path: apps/bare-expo/artifacts
126      - name: �� Notify on Slack
127        uses: 8398a7/action-slack@v3
128        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
129        env:
130          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
132        with:
133          channel: '#expo-ios'
134          status: ${{ job.status }}
135          fields: job,message,ref,eventName,author,took
136          author_name: Test Suite (iOS)
137
138  android:
139    runs-on: macos-12
140    env:
141      ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64
142      GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m
143    strategy:
144      matrix:
145        api-level: [31]
146    steps:
147      - name: �� Checkout
148        uses: actions/checkout@v3
149        with:
150          submodules: true
151      - name: ⬢ Setup Node
152        uses: actions/setup-node@v3
153        with:
154          node-version: 16
155      - name: �� Use JDK 11
156        uses: actions/setup-java@v3
157        with:
158          distribution: 'temurin'
159          java-version: '11'
160      - name: �� Install required tools
161        run: brew install watchman
162      - name: ➕ Add `bin` to GITHUB_PATH
163        run: echo "$(pwd)/bin" >> $GITHUB_PATH
164      - name: ♻️ Restore caches
165        uses: ./.github/actions/expo-caches
166        id: expo-caches
167        with:
168          yarn-workspace: 'true'
169          yarn-tools: 'true'
170          avd: 'true'
171          avd-api: ${{ matrix.api-level }}
172          react-native-gradle-downloads: 'true'
173      - name: �� Install workspace node modules
174        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
175        run: yarn install --frozen-lockfile
176      - name: ⚛️ Display React Native config
177        run: yarn react-native config
178        working-directory: apps/bare-expo
179      - name: �� Clean Detox
180        run: yarn detox:clean
181        working-directory: apps/bare-expo
182      - name: ��️ Build Android project for Detox
183        run: yarn android:detox:build:release
184        working-directory: apps/bare-expo
185        timeout-minutes: 35
186        env:
187          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'
188      - name: �� Run tests
189        uses: reactivecircus/android-emulator-runner@v2
190        with:
191          api-level: ${{ matrix.api-level }}
192          avd-name: avd-${{ matrix.api-level }}
193          arch: x86_64
194          force-avd-creation: false
195          script: yarn android:detox:test:release
196          working-directory: ./apps/bare-expo
197      - name: �� Store images of build failures
198        if: always()
199        uses: actions/upload-artifact@v3
200        with:
201          name: bare-expo-artifacts
202          path: apps/bare-expo/artifacts
203      - name: �� Notify on Slack
204        uses: 8398a7/action-slack@v3
205        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
206        env:
207          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }}
209          MATRIX_CONTEXT: ${{ toJson(matrix) }}
210        with:
211          channel: '#expo-android'
212          status: ${{ job.status }}
213          fields: job,message,ref,eventName,author,took
214          author_name: Test Suite (Android)
215