1name: Android Instrumentation Tests
2
3on:
4  workflow_dispatch: {}
5  push:
6    branches: [main]
7    paths:
8      - .github/workflows/android-instrumentation-tests.yml
9      - android/**
10      - fastlane/**
11      # - packages/**/android/**
12      - packages/expo-eas-client/android/**
13      - packages/expo-json-utils/android/**
14      - packages/expo-manifests/android/**
15      - packages/expo-updates/android/**
16      - yarn.lock
17      - '!packages/@expo/cli/**'
18  pull_request:
19    paths:
20      - .github/workflows/android-instrumentation-tests.yml
21      - android/**
22      - fastlane/**
23      # - packages/**/android/**
24      - packages/expo-eas-client/android/**
25      - packages/expo-json-utils/android/**
26      - packages/expo-manifests/android/**
27      - packages/expo-updates/android/**
28      - yarn.lock
29      - '!packages/@expo/cli/**'
30
31concurrency:
32  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
33  cancel-in-progress: true
34
35jobs:
36  test:
37    runs-on: macos-12
38    timeout-minutes: 120
39    env:
40      ORG_GRADLE_PROJECT_reactNativeArchitectures: x86_64
41      GRADLE_OPTS: -Dorg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=1024m
42    strategy:
43      matrix:
44        api-level: [31]
45    steps:
46      - name: ⬢ Setup Node
47        uses: actions/setup-node@v3
48        with:
49          node-version: 16
50      - name: �� Check out repository
51        uses: actions/checkout@v3
52        with:
53          submodules: true
54      - name: �� Use JDK 11
55        uses: actions/setup-java@v3
56        with:
57          distribution: 'temurin'
58          java-version: '11'
59      - name: ♻️ Restore caches
60        uses: ./.github/actions/expo-caches
61        id: expo-caches
62        with:
63          yarn-workspace: 'true'
64          yarn-tools: 'true'
65          avd: 'true'
66          avd-api: ${{ matrix.api-level }}
67          hermes-engine-aar: 'true'
68          react-native-gradle-downloads: 'true'
69      - name: ➕ Add `bin` to GITHUB_PATH
70        run: echo "$(pwd)/bin" >> $GITHUB_PATH
71      - name: �� Install node modules in root dir
72        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
73        run: yarn install --frozen-lockfile
74      - name: �� Run instrumented unit tests
75        timeout-minutes: 80
76        uses: reactivecircus/android-emulator-runner@v2
77        with:
78          api-level: ${{ matrix.api-level }}
79          avd-name: avd-${{ matrix.api-level }}
80          arch: x86_64
81          force-avd-creation: false
82          script: expotools android-native-unit-tests --type instrumented
83          disk-size: 2048M
84      - name: �� Save test results
85        if: always()
86        uses: actions/upload-artifact@v3
87        with:
88          name: test-results
89          path: packages/**/build/outputs/androidTest-results/**/*
90