xref: /expo/.github/workflows/test-suite.yml (revision f2fbea2e)
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: '14.17'
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      - 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-11
66    steps:
67      - name: �� Checkout
68        uses: actions/checkout@v3
69        with:
70          submodules: true
71      - name: �� Switch to Xcode 13.2.1
72        run: sudo xcode-select --switch /Applications/Xcode_13.2.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-11
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: '14.17'
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      - name: �� Install workspace node modules
171        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
172        run: yarn install --frozen-lockfile
173      - name: ⚛️ Display React Native config
174        run: yarn react-native config
175        working-directory: apps/bare-expo
176      - name: �� Clean Detox
177        run: yarn detox:clean
178        working-directory: apps/bare-expo
179      - name: ��️ Build Android project for Detox
180        run: yarn android:detox:build:release
181        working-directory: apps/bare-expo
182        timeout-minutes: 35
183        env:
184          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'
185      - name: �� Run tests
186        uses: reactivecircus/android-emulator-runner@v2
187        with:
188          api-level: ${{ matrix.api-level }}
189          avd-name: avd-${{ matrix.api-level }}
190          arch: x86_64
191          force-avd-creation: false
192          script: yarn android:detox:test:release
193          working-directory: ./apps/bare-expo
194      - name: �� Store images of build failures
195        if: always()
196        uses: actions/upload-artifact@v3
197        with:
198          name: bare-expo-artifacts
199          path: apps/bare-expo/artifacts
200      - name: �� Notify on Slack
201        uses: 8398a7/action-slack@v3
202        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
203        env:
204          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
205          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_android }}
206          MATRIX_CONTEXT: ${{ toJson(matrix) }}
207        with:
208          channel: '#expo-android'
209          status: ${{ job.status }}
210          fields: job,message,ref,eventName,author,took
211          author_name: Test Suite (Android)
212