1name: Android Instrumentation Tests
2
3on:
4  workflow_dispatch: {}
5  push:
6    branches: [master]
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    env:
29      NDK_ABI_FILTERS: x86_64
30    steps:
31      - name: �� Check out repository
32        uses: actions/checkout@v2
33        with:
34          submodules: true
35      - name: ♻️ Restore workspace node modules
36        uses: actions/cache@v2
37        id: node-modules-cache
38        with:
39          path: |
40            # See "workspaces" → "packages" in the root package.json for the source of truth of
41            # which node_modules are affected by the root yarn.lock
42            node_modules
43            apps/*/node_modules
44            home/node_modules
45            packages/*/node_modules
46            packages/@unimodules/*/node_modules
47            react-native-lab/react-native/node_modules
48          key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
49      - name: �� Install node modules in root dir
50        run: yarn install --frozen-lockfile
51      - name: ♻️ Restore node modules in tools
52        uses: actions/cache@v2
53        with:
54          path: tools/node_modules
55          key: ${{ runner.os }}-tools-modules-${{ hashFiles('tools/yarn.lock') }}
56      - name: ♻️ Restore Gradle caches
57        uses: actions/cache@v2
58        with:
59          path: ~/.gradle/caches
60          key: ${{ runner.os }}-gradle-${{ hashFiles('android/*.gradle*') }}
61          restore-keys: |
62            ${{ runner.os }}-gradle-
63      - name: �� Patch react-native to support single abi
64        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
65        working-directory: react-native-lab/react-native
66      - name: �� Run instrumented unit tests
67        uses: reactivecircus/android-emulator-runner@v2
68        with:
69          api-level: 29
70          arch: x86_64
71          script: bin/expotools android-native-unit-tests --type instrumented
72