xref: /expo/.github/workflows/test-suite.yml (revision 7aeb2b0c)
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      - '!packages/expo/bin/**'
23      - '!packages/expo/e2e/**'
24
25concurrency:
26  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
27  cancel-in-progress: true
28
29jobs:
30  web:
31    runs-on: ubuntu-18.04
32    steps:
33      - name: ⬢ Setup Node
34        uses: actions/setup-node@v2
35        with:
36          node-version: '14.17'
37      - name: �� Checkout
38        uses: actions/checkout@v2
39        with:
40          submodules: true
41      - name: ♻️ Restore workspace node modules
42        uses: actions/cache@v2
43        id: node-modules-cache
44        with:
45          path: |
46            # See "workspaces" → "packages" in the root package.json for the source of truth of
47            # which node_modules are affected by the root yarn.lock
48            node_modules
49            apps/*/node_modules
50            home/node_modules
51            packages/*/node_modules
52            packages/@unimodules/*/node_modules
53            react-native-lab/react-native/node_modules
54          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
55      - name: �� Install node modules in root dir
56        run: yarn install --frozen-lockfile
57      - run: yarn global add expo-cli
58      - run: yarn test:web
59        working-directory: apps/bare-expo
60      - name: �� Notify on Slack
61        uses: 8398a7/action-slack@v3
62        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
63        env:
64          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_web }}
66        with:
67          channel: '#expo-web'
68          status: ${{ job.status }}
69          fields: job,message,ref,eventName,author,took
70          author_name: Test Suite (Web)
71
72  ios:
73    runs-on: macos-11
74    steps:
75      - name: �� Checkout
76        uses: actions/checkout@v2
77        with:
78          submodules: true
79      - name: �� Switch to Xcode 13.0
80        run: sudo xcode-select --switch /Applications/Xcode_13.0.app
81      - name: �� Install required tools
82        run: |
83          brew tap wix/brew
84          brew install applesimutils
85          brew install watchman
86          echo "$(pwd)/bin" >> $GITHUB_PATH
87      - name: �� Setup Ruby and install gems
88        uses: ruby/setup-ruby@v1
89        with:
90          bundler-cache: true
91      - name: ♻️ Restore workspace node modules
92        uses: actions/cache@v2
93        id: node-modules-cache
94        with:
95          path: |
96            # See "workspaces" → "packages" in the root package.json for the source of truth of
97            # which node_modules are affected by the root yarn.lock
98            node_modules
99            apps/*/node_modules
100            home/node_modules
101            packages/*/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      NDK_ABI_FILTERS: x86_64
160    steps:
161      - name: �� Checkout
162        uses: actions/checkout@v2
163        with:
164          submodules: true
165      - name: �� Install required tools
166        run: |
167          brew install watchman
168          echo "$(pwd)/bin" >> $GITHUB_PATH
169      - name: ♻️ Restore workspace node modules
170        uses: actions/cache@v2
171        id: node-modules-cache
172        with:
173          path: |
174            # See "workspaces" → "packages" in the root package.json for the source of truth of
175            # which node_modules are affected by the root yarn.lock
176            node_modules
177            apps/*/node_modules
178            home/node_modules
179            packages/*/node_modules
180            packages/@unimodules/*/node_modules
181            react-native-lab/react-native/node_modules
182          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
183      - name: �� Install node modules in root dir
184        run: yarn install --frozen-lockfile
185      - uses: actions/cache@v2
186        with:
187          path: ~/.gradle/caches
188          key: ${{ runner.os }}-gradle-v20210625-${{ hashFiles('android/*.gradle*') }}
189          restore-keys: |
190            ${{ runner.os }}-gradle-v20210625
191      - name: ⚛️ Display React Native config
192        run: yarn react-native config
193        working-directory: apps/bare-expo
194      - name: �� Clean Detox
195        run: yarn detox:clean
196        working-directory: apps/bare-expo
197      - name: ��️ Build Android project for Detox
198        run: yarn android:detox:build:release
199        working-directory: apps/bare-expo
200        timeout-minutes: 35
201        env:
202          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'
203      - name: Run tests
204        uses: reactivecircus/android-emulator-runner@v2
205        with:
206          api-level: 29
207          arch: x86_64
208          avd-name: bare-expo
209          script: yarn android:detox:test:release
210          working-directory: ./apps/bare-expo
211      - name: Store images of build failures
212        if: always()
213        uses: actions/upload-artifact@v2
214        with:
215          name: bare-expo-artifacts
216          path: apps/bare-expo/artifacts
217      - name: �� Notify on Slack
218        uses: 8398a7/action-slack@v3
219        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
220        env:
221          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }}
223        with:
224          channel: '#expo-android'
225          status: ${{ job.status }}
226          fields: job,message,ref,eventName,author,took
227          author_name: Test Suite (Android)
228