Skip to content

Commit 6bec3cf

Browse files
authored
Add a tvOS build workflow (#480)
First pass at a workflow to build the Unity SDK for tvOS platforms.
1 parent cb775b6 commit 6bec3cf

File tree

3 files changed

+168
-12
lines changed

3 files changed

+168
-12
lines changed

.github/workflows/build_tvos.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Workflow to handle building the Unity SDK on tvOS
2+
name: Build tvOS (SubWorkflow)
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
unity_version:
8+
description: 'Unity version'
9+
default: '2019'
10+
required: true
11+
type: string
12+
firebase_cpp_sdk_version:
13+
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
14+
default: 'v9.6.0'
15+
required: false
16+
type: string
17+
unity_branch:
18+
description: 'Unity branch to build against, empty means current branch'
19+
default: ''
20+
type: string
21+
apis:
22+
description: 'CSV of apis to build and test'
23+
default: 'analytics,auth,crashlytics,database,firestore,functions,installations,messaging,remote_config,storage'
24+
required: true
25+
type: string
26+
unity_platform_name:
27+
description: 'The platform name Unity should install with'
28+
default: 'tvOS'
29+
required: true
30+
type: string
31+
32+
workflow_call:
33+
inputs:
34+
unity_version:
35+
description: 'Unity version'
36+
default: '2019'
37+
required: true
38+
type: string
39+
firebase_cpp_sdk_version:
40+
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout)'
41+
default: ''
42+
required: false
43+
type: string
44+
unity_branch:
45+
description: 'Unity branch to build against, empty means current branch'
46+
default: ''
47+
type: string
48+
apis:
49+
description: 'CSV of apis to build and test'
50+
default: 'analytics,auth,crashlytics,database,firestore,functions,installations,messaging,remote_config,storage'
51+
required: true
52+
type: string
53+
unity_platform_name:
54+
description: 'The platform name Unity should install with'
55+
default: ''
56+
required: true
57+
type: string
58+
59+
jobs:
60+
build_tvos:
61+
name: build-tvos-unity${{ inputs.unity_version }}-CPP${{ inputs.firebase_cpp_sdk_version }}
62+
runs-on: macos-12
63+
strategy:
64+
fail-fast: false
65+
66+
env:
67+
# LC_ALL, LANG and U3D_PASSWORD are needed for U3D.
68+
LC_ALL: en_US.UTF-8
69+
LANG: en_US.UTF-8
70+
U3D_PASSWORD: ""
71+
# Disable checking for U3D updates, since it is buggy
72+
U3D_SKIP_UPDATE_CHECK: 1
73+
xcodeVersion: "13.3.1"
74+
75+
steps:
76+
- name: Checkout Unity Repo
77+
uses: actions/checkout@v2
78+
with:
79+
submodules: true
80+
ref: ${{ inputs.unity_branch }}
81+
82+
- name: Checkout CPP Repo
83+
uses: actions/checkout@v2
84+
with:
85+
repository: firebase/firebase-cpp-sdk
86+
path: firebase-cpp-sdk
87+
ref: ${{ inputs.firebase_cpp_sdk_version }}
88+
submodules: true
89+
90+
- name: Setup python
91+
uses: actions/setup-python@v2
92+
with:
93+
python-version: '3.7'
94+
95+
- name: setup Xcode version
96+
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
97+
98+
- name: Install prerequisites
99+
shell: bash
100+
run: |
101+
echo "FIREBASE_CPP_SDK_DIR=${{ github.workspace }}/firebase-cpp-sdk" >> $GITHUB_ENV
102+
cd firebase-cpp-sdk
103+
python scripts/gha/install_prereqs_desktop.py
104+
cd ..
105+
106+
- name: Install Unity installer (U3D)
107+
uses: nick-invision/retry@v2
108+
with:
109+
timeout_minutes: 10
110+
max_attempts: 3
111+
shell: bash
112+
command: gem install u3d -v 1.2.3
113+
114+
- name: Install python deps
115+
shell: bash
116+
run: |
117+
pip install -r scripts/gha/requirements.txt
118+
119+
- name: Install Unity
120+
uses: nick-invision/retry@v2
121+
with:
122+
timeout_minutes: 15
123+
max_attempts: 3
124+
shell: bash
125+
command: |
126+
python scripts/gha/unity_installer.py --install --platforms ${{ inputs.unity_platform_name }} --version ${{ inputs.unity_version }}
127+
128+
- name: Setup Unity path
129+
shell: bash
130+
run: |
131+
echo "UNITY_ROOT_DIR=$( python scripts/gha/print_matrix_configuration.py -u ${{ inputs.unity_version }} -k unity_path )" >> $GITHUB_ENV
132+
133+
- name: Build SDK (tvOS)
134+
timeout-minutes: 90
135+
shell: bash
136+
run: |
137+
# TODO add handling cmake_extras
138+
python scripts/build_scripts/build_zips.py --gha --platform=tvos --unity_root=$UNITY_ROOT_DIR --apis=${{ inputs.apis }}
139+
140+
- name: Check zip file
141+
shell: bash
142+
run: |
143+
if [ -f tvos_unity/*.zip ]; then
144+
echo "tvos_unity zip created."
145+
else
146+
echo "Fail to create tvos_unity zip."
147+
exit 1
148+
fi
149+
150+
- name: Upload Build
151+
uses: actions/upload-artifact@v2
152+
with:
153+
name: tvos_unity
154+
path: tvos_unity/*.zip

scripts/gha/print_matrix_configuration.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
}
6868
},
6969
"config": {
70-
"platform": "Windows,macOS,Linux,Android,iOS,Playmode",
70+
"platform": "Windows,macOS,Linux,Android,iOS,tvOS,Playmode",
7171
"apis": "analytics,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage",
7272
"mobile_test_on": "real"
7373
}
@@ -82,49 +82,49 @@
8282
"2020": {
8383
_WINDOWS: {
8484
"version": "2020.3.34f1",
85-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": None, "macOS": ["Mac-mono"], "Linux": ["Linux-mono"]},
85+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": None, "macOS": ["Mac-mono"], "Linux": ["Linux-mono"]},
8686
"ndk": "https://dl.google.com/android/repository/android-ndk-r19-windows-x86_64.zip"
8787
},
8888
_MACOS: {
8989
"version": "2020.3.34f1",
90-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-mono"], "macOS": None, "Linux": ["Linux-mono"]},
90+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-mono"], "macOS": None, "Linux": ["Linux-mono"]},
9191
"ndk": "https://dl.google.com/android/repository/android-ndk-r19-darwin-x86_64.zip"
9292
},
9393
_LINUX: {
9494
"version": "2020.3.29f1",
95-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-mono"], "macOS": ["Mac-mono"], "Linux": None}
95+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-mono"], "macOS": ["Mac-mono"], "Linux": None}
9696
}
9797
},
9898
"2019": {
9999
_WINDOWS: {
100100
"version": "2019.4.39f1",
101-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": None, "macOS": ["Mac-mono"], "Linux": ["Linux-mono"]},
101+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": None, "macOS": ["Mac-mono"], "Linux": ["Linux-mono"]},
102102
"ndk": "https://dl.google.com/android/repository/android-ndk-r19-windows-x86_64.zip"
103103
},
104104
_MACOS: {
105105
"version": "2019.4.39f1",
106-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-mono"], "macOS": None, "Linux": ["Linux-mono"]},
106+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-mono"], "macOS": None, "Linux": ["Linux-mono"]},
107107
"ndk": "https://dl.google.com/android/repository/android-ndk-r19-darwin-x86_64.zip"
108108
},
109109
_LINUX: {
110110
"version": "2019.4.40f1",
111-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-mono"], "macOS": ["Mac-mono"], "Linux": None}
111+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-mono"], "macOS": ["Mac-mono"], "Linux": None}
112112
}
113113
},
114114
"2018": {
115115
_WINDOWS: {
116116
"version": "2018.4.36f1",
117-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-il2cpp"], "macOS": ["Mac-mono"], "Linux": ["Linux"]},
117+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-il2cpp"], "macOS": ["Mac-mono"], "Linux": ["Linux"]},
118118
"ndk": "https://dl.google.com/android/repository/android-ndk-r16b-windows-x86_64.zip"
119119
},
120120
_MACOS: {
121121
"version": "2018.4.36f1",
122-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-mono"], "macOS": ["Mac-il2cpp"], "Linux": ["Linux"]},
122+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-mono"], "macOS": ["Mac-il2cpp"], "Linux": ["Linux"]},
123123
"ndk": "https://dl.google.com/android/repository/android-ndk-r16b-darwin-x86_64.zip"
124124
},
125125
_LINUX: {
126126
"version": "2018.3.0f2",
127-
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "Windows": ["Windows-mono"], "macOS": ["Mac-mono"], "Linux": None}
127+
"packages": {"Default": ["Unity"], "Android": ["Android"], "iOS": ["Ios"], "tvOS": ["appletv"], "Windows": ["Windows-mono"], "macOS": ["Mac-mono"], "Linux": None}
128128
}
129129
},
130130
}
@@ -228,7 +228,8 @@ def filterdesktop_os(platform):
228228

229229

230230
def filter_mobile_platform(platform):
231-
mobile_platform = ["Android", "iOS"]
231+
# tvOS isn't mobile, but it behaves like iOS.
232+
mobile_platform = ["Android", "iOS", "tvOS"]
232233
filtered_value = filter(lambda p: p in platform, mobile_platform)
233234
return list(filtered_value)
234235

scripts/gha/unity_installer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,11 @@
8888
_DEFALUT = "Default"
8989
_ANDROID = "Android"
9090
_IOS = "iOS"
91+
_TVOS ="tvOS"
9192
_WINDOWS = "Windows"
9293
_MACOS = "macOS"
9394
_LINUX = "Linux"
94-
_SUPPORTED_PLATFORMS = (_ANDROID, _IOS, _WINDOWS, _MACOS, _LINUX)
95+
_SUPPORTED_PLATFORMS = (_ANDROID, _IOS, _TVOS, _WINDOWS, _MACOS, _LINUX)
9596

9697
FLAGS = flags.FLAGS
9798

0 commit comments

Comments
 (0)