-
Notifications
You must be signed in to change notification settings - Fork 38
141 lines (126 loc) · 4.23 KB
/
build_android.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Workflow to handle building the Unity SDK on android
name: Build Android (SubWorkflow)
on:
workflow_call:
inputs:
unity_version:
description: 'Unity version'
default: '2021'
required: true
type: string
firebase_cpp_sdk_version:
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
default: ''
required: false
type: string
unity_branch:
description: 'Unity branch to build against, empty means current branch'
default: ''
type: string
apis:
description: 'CSV of apis to build and test'
default: 'analytics,app_check,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'
required: true
type: string
unity_platform_name:
description: 'The platform name Unity should install with'
default: ''
required: true
type: string
# Additional CMake flags to use
additional_cmake_flags:
description: 'Additional flags to pass into CMake'
default: ''
required: false
type: string
jobs:
build_android:
name: build-android-unity${{ inputs.unity_version }}-CPP${{ inputs.firebase_cpp_sdk_version }}
runs-on: macos-13
strategy:
fail-fast: false
env:
CCACHE_DIR: ${{ github.workspace }}/ccache_dir
steps:
- name: Checkout Unity Repo
uses: actions/checkout@v3
with:
submodules: true
ref: ${{ inputs.unity_branch }}
fetch-depth: 0
- name: Checkout CPP Repo
uses: actions/checkout@v3
with:
repository: firebase/firebase-cpp-sdk
path: firebase-cpp-sdk
ref: ${{ inputs.firebase_cpp_sdk_version }}
submodules: true
fetch-depth: 0
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Cache NDK
id: cache_ndk
uses: actions/cache@v3
with:
path: /tmp/android-ndk-r21e
key: android-ndk-${{ matrix.os }}-r21e
- name: Check cached NDK
shell: bash
if: steps.cache_ndk.outputs.cache-hit != 'true'
run: |
# If the NDK failed to download from the cache, but there is a
# /tmp/android-ndk-r21e directory, it's incomplete, so remove it.
if [[ -d "/tmp/android-ndk-r21e" ]]; then
echo "Removing incomplete download of NDK"
rm -rf /tmp/android-ndk-r21e
fi
- name: Install prerequisites
shell: bash
run: |
echo "FIREBASE_CPP_SDK_DIR=${{ github.workspace }}/firebase-cpp-sdk" >> $GITHUB_ENV
cd firebase-cpp-sdk
python scripts/gha/install_prereqs_desktop.py
build_scripts/android/install_prereqs.sh
cd ..
echo "NDK_ROOT=/tmp/android-ndk-r21e" >> $GITHUB_ENV
echo "ANDROID_NDK_HOME=/tmp/android-ndk-r21e" >> $GITHUB_ENV
brew install swig
- name: Force Java 11
shell: bash
run: echo "JAVA_HOME=${JAVA_HOME_11_X64}" >> $GITHUB_ENV
- name: Install python deps
shell: bash
run: |
pip install -r scripts/gha/requirements.txt
- id: unity_setup
uses: ./gha/unity
timeout-minutes: 30
with:
version: ${{ inputs.unity_version }}
platforms: ${{ inputs.unity_platform_name }}
- name: Display Swig Version
shell: bash
run: |
swig -version
- name: Build SDK (Android)
timeout-minutes: 90
shell: bash
run: |
# TODO add handling cmake_extras
python scripts/build_scripts/build_zips.py --gha --platform=android --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
- name: Check zip file
shell: bash
run: |
if [ -f android_unity/*.zip ]; then
echo "android_unity zip created."
else
echo "Fail to create android_unity zip."
exit 1
fi
- name: Upload Build
uses: actions/upload-artifact@v4
with:
name: android_unity
path: android_unity/*.zip