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-11
38    timeout-minutes: 60
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: '14.17'
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      - name: ➕ Add `bin` to GITHUB_PATH
69        run: echo "$(pwd)/bin" >> $GITHUB_PATH
70      - name: �� Install node modules in root dir
71        if: steps.expo-caches.outputs.yarn-workspace-hit != 'true'
72        run: yarn install --frozen-lockfile
73      - name: �� Run instrumented unit tests
74        timeout-minutes: 40
75        uses: reactivecircus/android-emulator-runner@v2
76        with:
77          api-level: ${{ matrix.api-level }}
78          avd-name: avd-${{ matrix.api-level }}
79          arch: x86_64
80          force-avd-creation: false
81          script: expotools android-native-unit-tests --type instrumented
82      - name: �� Save test results
83        if: always()
84        uses: actions/upload-artifact@v3
85        with:
86          name: test-results
87          path: packages/**/build/test-reports/**/*xml
88