1name: Android Unit Tests
2
3on:
4  push:
5    branches: [ master ]
6    paths:
7      - .github/workflows/android-unit-tests.yml
8      - 'android/**'
9      - 'fastlane/**'
10      - 'tools/expotools/**'
11      - yarn.lock
12  pull_request:
13    branches: [ master ]
14    paths:
15      - .github/workflows/android-unit-tests.yml
16      - 'android/**'
17      - 'fastlane/**'
18      - 'tools/expotools/**'
19      - yarn.lock
20
21jobs:
22  test:
23    runs-on: ubuntu-18.04
24    steps:
25      - name: Check out repository
26        uses: actions/checkout@v2
27        with:
28          submodules: true
29      - name: Get yarn cache directory path
30        id: yarn-cache-dir-path
31        run: echo "::set-output name=dir::$(yarn cache dir)"
32      - uses: actions/cache@v1
33        with:
34          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
35          key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
36          restore-keys: |
37            ${{ runner.os }}-yarn-
38      - run: yarn install --frozen-lockfile
39      - uses: actions/cache@v1
40        with:
41          path: ~/.gradle/caches
42          key: ${{ runner.os }}-gradle-${{ hashFiles('android/*.gradle*') }}
43          restore-keys: |
44            ${{ runner.os }}-gradle-
45      - run: echo "::add-path::$(pwd)/bin"
46      - run: expotools native-unit-tests --platform android
47      - name: Save test results
48        if: always()
49        uses: actions/upload-artifact@v2
50        with:
51          name: test-results
52          path: packages/**/build/test-results/**/*xml
53