xref: /expo/.github/workflows/test-suite.yml (revision bb8f4f99)
1name: Test Suite
2
3on:
4  workflow_dispatch: {}
5  push:
6    branches: [master, '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    branches: [master]
15    paths:
16      - .github/workflows/test-suite.yml
17      - apps/bare-expo/**
18      - apps/test-suite/**
19      - packages/**
20      - yarn.lock
21
22jobs:
23  web:
24    runs-on: ubuntu-18.04
25    steps:
26      - name: ⬢ Setup Node
27        uses: actions/setup-node@v2
28        with:
29          node-version: '14.4.0'
30      - name: �� Checkout
31        uses: actions/checkout@v2
32        with:
33          submodules: true
34      - name: ♻️ Restore workspace node modules
35        uses: actions/cache@v2
36        id: node-modules-cache
37        with:
38          path: |
39            # See "workspaces" → "packages" in the root package.json for the source of truth of
40            # which node_modules are affected by the root yarn.lock
41            node_modules
42            apps/*/node_modules
43            home/node_modules
44            packages/*/node_modules
45            packages/@unimodules/*/node_modules
46            react-native-lab/react-native/node_modules
47          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
48      - name: �� Install node modules in root dir
49        if: steps.node-modules-cache.outputs.cache-hit != 'true'
50        run: yarn install --frozen-lockfile
51      - run: yarn global add expo-cli
52      - run: yarn test:web
53        working-directory: apps/bare-expo
54      - name: �� Notify on Slack
55        uses: 8398a7/action-slack@v3
56        if: failure() && (github.event.ref == 'refs/heads/master' || 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: '#platform-web'
62          status: ${{ job.status }}
63          fields: job,commit,ref,eventName,author,took
64          author_name: Test Suite (Web)
65
66  ios:
67    runs-on: macos-10.15
68    steps:
69      - name: �� Checkout
70        uses: actions/checkout@v2
71        with:
72          submodules: true
73      - name: �� Install required tools
74        run: |
75          brew tap wix/brew
76          brew install applesimutils
77          brew install watchman
78          echo "$(pwd)/bin" >> $GITHUB_PATH
79      - name: �� Setup Ruby and install gems
80        uses: ruby/setup-ruby@v1
81        with:
82          bundler-cache: true
83      - name: ♻️ Restore workspace node modules
84        uses: actions/cache@v2
85        id: node-modules-cache
86        with:
87          path: |
88            # See "workspaces" → "packages" in the root package.json for the source of truth of
89            # which node_modules are affected by the root yarn.lock
90            node_modules
91            apps/*/node_modules
92            home/node_modules
93            packages/*/node_modules
94            packages/@unimodules/*/node_modules
95            react-native-lab/react-native/node_modules
96          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
97      - name: �� Install node modules in root dir
98        if: steps.node-modules-cache.outputs.cache-hit != 'true'
99        run: yarn install --frozen-lockfile
100      - name: ♻️ Restore apps/bare-expo/ios/Pods from cache
101        uses: actions/cache@v2
102        id: pods-cache
103        with:
104          path: 'apps/bare-expo/ios/Pods'
105          key: ${{ runner.os }}-bare-expo-pods-${{ hashFiles('apps/bare-expo/ios/Podfile.lock') }}
106          restore-keys: |
107            ${{ runner.os }}-bare-expo-pods-
108      - name: ��️ Debug CocoaPods lockfiles
109        run: git diff Podfile.lock Pods/Manifest.lock
110        working-directory: apps/bare-expo/ios
111        continue-on-error: true
112      - name: �� Install pods in apps/bare-expo/ios
113        run: pod install
114        if: steps.pods-cache.outputs.cache-hit != 'true' || hashFiles('apps/bare-expo/ios/Podfile.lock') != hashFiles('apps/bare-expo/ios/Pods/Manifest.lock')
115        working-directory: apps/bare-expo/ios
116      - name: Clean Detox
117        run: yarn detox:clean
118        working-directory: apps/bare-expo
119      - name: Build iOS project for Detox
120        run: yarn ios:detox:build:release
121        working-directory: apps/bare-expo
122        timeout-minutes: 30
123      - name: Run tests
124        run: yarn ios:detox:test:release
125        working-directory: apps/bare-expo
126      - name: Store images of build failures
127        if: always()
128        uses: actions/upload-artifact@v2
129        with:
130          name: bare-expo-artifacts
131          path: apps/bare-expo/artifacts
132      - name: �� Notify on Slack
133        uses: 8398a7/action-slack@v3
134        if: failure() && (github.event.ref == 'refs/heads/master' || startsWith(github.event.ref, 'refs/heads/sdk-'))
135        env:
136          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
137          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_ios }}
138        with:
139          channel: '#platform-ios'
140          status: ${{ job.status }}
141          fields: job,commit,ref,eventName,author,took
142          author_name: Test Suite (iOS)
143