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-13
38    timeout-minutes: 150
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: [33]
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          gradle: 'true'
64          yarn-workspace: 'true'
65          yarn-tools: 'true'
66          hermes-engine-aar: 'true'
67          react-native-gradle-downloads: '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: 80
75        uses: ./.github/actions/use-android-emulator
76        with:
77          avd-api: ${{ matrix.api-level }}
78          avd-name: avd-${{ matrix.api-level }}
79          script: expotools android-native-unit-tests --type instrumented
80      - name: �� Save test results
81        if: always()
82        uses: actions/upload-artifact@v3
83        with:
84          name: test-results
85          path: packages/**/build/outputs/androidTest-results/**/*
86