1name: Android Instrumentation Tests
2
3on:
4  workflow_dispatch: {}
5  push:
6    branches: [main]
7    paths:
8      - .github/workflows/android-instrumentation-tests.yml
9      - 'fastlane/**'
10      - 'packages/**/android/**'
11      - 'tools/**'
12      - yarn.lock
13  pull_request:
14    paths:
15      - .github/workflows/android-instrumentation-tests.yml
16      - 'fastlane/**'
17      - 'packages/**/android/**'
18      - 'tools/**'
19      - yarn.lock
20
21concurrency:
22  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
23  cancel-in-progress: true
24
25jobs:
26  test:
27    runs-on: macos-11
28    timeout-minutes: 60
29    env:
30      NDK_ABI_FILTERS: x86_64
31    steps:
32      - name: ⬢ Setup Node
33        uses: actions/setup-node@v2
34        with:
35          node-version: '14.17'
36      - name: �� Check out repository
37        uses: actions/checkout@v2
38        with:
39          submodules: true
40      - name: ♻️ Restore workspace node modules
41        uses: actions/cache@v2
42        id: node-modules-cache
43        with:
44          path: |
45            # See "workspaces" → "packages" in the root package.json for the source of truth of
46            # which node_modules are affected by the root yarn.lock
47            node_modules
48            apps/*/node_modules
49            home/node_modules
50            packages/*/node_modules
51            packages/@expo/*/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      - name: ♻️ Restore node modules in tools
58        uses: actions/cache@v2
59        with:
60          path: tools/node_modules
61          key: ${{ runner.os }}-tools-modules-${{ hashFiles('tools/yarn.lock') }}
62      - name: ♻️ Restore Gradle caches
63        uses: actions/cache@v2
64        with:
65          path: ~/.gradle/caches
66          key: ${{ runner.os }}-gradle-${{ hashFiles('android/*.gradle*') }}
67          restore-keys: |
68            ${{ runner.os }}-gradle-
69      - name: �� Patch react-native to support single abi
70        run: sed -i '' 's/^APP_ABI := .*$/APP_ABI := $(if $(NDK_ABI_FILTERS),$(NDK_ABI_FILTERS),$(armeabi-v7a x86 arm64-v8a x86_64))/g' ReactAndroid/src/main/jni/Application.mk
71        working-directory: react-native-lab/react-native
72      - name: �� Run instrumented unit tests
73        timeout-minutes: 40
74        uses: reactivecircus/android-emulator-runner@v2
75        with:
76          api-level: 29
77          arch: x86_64
78          script: bin/expotools android-native-unit-tests --type instrumented
79