-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (82 loc) · 2.87 KB
/
android-unit-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Android Unit Tests
on:
workflow_dispatch: {}
push:
branches: [master]
paths:
- .github/workflows/android-unit-tests.yml
- android/**
- fastlane/**
- packages/**/android/**
- tools/**
- yarn.lock
pull_request:
paths:
- .github/workflows/android-unit-tests.yml
- android/**
- fastlane/**
- packages/**/android/**
- tools/**
- yarn.lock
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-18.04
env:
NDK_ABI_FILTERS: x86_64
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
submodules: true
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
name: Restore yarn cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --frozen-lockfile
- uses: actions/cache@v2
name: Restore Gradle cache
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('android/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v2
name: Restore NDK cache
id: cache-android-ndk
with:
path: /usr/local/lib/android/sdk/ndk/19.2.5345600/
key: ${{ runner.os }}-ndk-19.2.5345600
restore-keys: |
${{ runner.os }}-ndk-
- name: Install NDK
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
run: |
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;19.2.5345600"
- run: echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Patch react-native to support single abi
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
working-directory: react-native-lab/react-native
- name: Run Spotless lint check
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
working-directory: android
run: ./gradlew spotlessCheck || { echo '::error Spotless lint failed. Run `./gradlew spotlessApply` to automatically fix formatting.' && exit 1; }
- name: Run native Android unit tests
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
run: expotools native-unit-tests --platform android
- name: Save test results
if: always()
uses: actions/upload-artifact@v2
with:
name: test-results
path: packages/**/build/test-results/**/*xml