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