xref: /expo/.github/workflows/test-suite.yml (revision eea2febf)
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: �� 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      - name: Run tests
116        run: yarn ios:detox:test:release
117        working-directory: apps/bare-expo
118      - name: Store images of build failures
119        if: always()
120        uses: actions/upload-artifact@v3
121        with:
122          name: bare-expo-artifacts
123          path: apps/bare-expo/artifacts
124      - name: �� Notify on Slack
125        uses: 8398a7/action-slack@v3
126        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
127        env:
128          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
130        with:
131          channel: '#expo-ios'
132          status: ${{ job.status }}
133          fields: job,message,ref,eventName,author,took
134          author_name: Test Suite (iOS)
135
136  android:
137    runs-on: macos-12
138    env:
139      ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64
140      GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=2048m
141    strategy:
142      matrix:
143        api-level: [31]
144    steps:
145      - name: �� Checkout
146        uses: actions/checkout@v3
147        with:
148          submodules: true
149      - name: ⬢ Setup Node
150        uses: actions/setup-node@v3
151        with:
152          node-version: 16
153      - name: �� Use JDK 11
154        uses: actions/setup-java@v3
155        with:
156          distribution: 'temurin'
157          java-version: '11'
158      - name: �� Install required tools
159        run: brew install watchman
160      - name: ➕ Add `bin` to GITHUB_PATH
161        run: echo "$(pwd)/bin" >> $GITHUB_PATH
162      - name: ♻️ Restore caches
163        uses: ./.github/actions/expo-caches
164        id: expo-caches
165        with:
166          yarn-workspace: 'true'
167          yarn-tools: 'true'
168          avd: 'true'
169          avd-api: ${{ matrix.api-level }}
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: �� Clean Detox
178        run: yarn detox:clean
179        working-directory: apps/bare-expo
180      - name: ��️ Build Android project for Detox
181        run: yarn android:detox:build:release
182        working-directory: apps/bare-expo
183        timeout-minutes: 35
184        env:
185          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'
186      - name: �� Run tests
187        uses: reactivecircus/android-emulator-runner@v2
188        with:
189          api-level: ${{ matrix.api-level }}
190          avd-name: avd-${{ matrix.api-level }}
191          arch: x86_64
192          force-avd-creation: false
193          script: yarn android:detox:test:release
194          working-directory: ./apps/bare-expo
195      - name: �� Store images of build failures
196        if: always()
197        uses: actions/upload-artifact@v3
198        with:
199          name: bare-expo-artifacts
200          path: apps/bare-expo/artifacts
201      - name: �� Notify on Slack
202        uses: 8398a7/action-slack@v3
203        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
204        env:
205          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
206          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }}
207          MATRIX_CONTEXT: ${{ toJson(matrix) }}
208        with:
209          channel: '#expo-android'
210          status: ${{ job.status }}
211          fields: job,message,ref,eventName,author,took
212          author_name: Test Suite (Android)
213