-
Notifications
You must be signed in to change notification settings - Fork 38
266 lines (250 loc) · 13.7 KB
/
build_starter.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# Workflow to handle triggering the build process
name: Firebase Unity SDK build
on:
schedule:
- cron: "0 7 * * *" # 7am UTC = 11pm PST / 12am PDT
pull_request:
types: [ labeled, closed ]
workflow_dispatch:
inputs:
unity_version:
description: 'Unity version'
default: '2021'
required: true
firebase_cpp_sdk_version:
description: 'Firebase CPP SDK version to build against (The branch, tag or SHA to checkout). Required if for release'
default: ''
required: false
unity_branch:
description: 'Unity branch to build against, empty means current branch'
default: ''
required: false
platforms:
description: 'Test Platforms of Android,iOS,Windows,macOS,Linux,Playmode'
default: 'Android,iOS,tvOS,Windows,macOS,Linux,Playmode'
required: true
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
# Additional CMake flags to use
additional_cmake_flags:
description: 'Additional flags to pass into CMake'
default: ''
required: false
release_version:
description: 'If the package is intended to run for a release, put <version> number like 9.1.0'
default: 'NoVersion'
type: string
required: true
rc_index:
description: 'If the package is intended to run for a release, put RC## for label'
default: 'NA'
type: string
required: true
should_trigger_package:
description: 'If we want to trigger package process'
default: true
type: boolean
required: true
runIntegrationTests:
description: 'run integration tests? (0 will not run integrations)'
default: '1'
required: true
env:
pythonVersion: '3.8'
jobs:
check_and_prepare:
runs-on: ubuntu-latest
outputs:
platform: ${{ steps.set_outputs.outputs.platform }}
release_label: ${{ steps.set_outputs.outputs.release_label }}
unity_version: ${{ steps.set_outputs.outputs.unity_version }}
apis: ${{ steps.set_outputs.outputs.apis }}
release_version: ${{ steps.set_outputs.outputs.release_version }}
should_trigger_package: ${{ steps.set_outputs.outputs.should_trigger_package }}
runIntegrationTests: ${{ steps.set_outputs.outputs.runIntegrationTests }}
firebase_cpp_sdk_version: ${{ steps.set_outputs.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ steps.set_outputs.outputs.unity_branch }}
additional_cmake_flags: ${{ steps.set_outputs.outputs.additional_cmake_flags }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.unity_branch }}
fetch-depth: 0
submodules: false
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ env.pythonVersion }}
- name: Install python deps
run: pip install -r scripts/gha/requirements.txt
- id: set_outputs
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
platform=$( python scripts/gha/print_matrix_configuration.py -c -w config -k platform -o "${{ github.event.inputs.platforms }}" )
echo "platform=${platform}" >> $GITHUB_OUTPUT
echo "release_label=${{ github.event.inputs.release_version }}-${{ github.event.inputs.rc_index }}" >> $GITHUB_OUTPUT
echo "release_version=${{ github.event.inputs.release_version }}" >> $GITHUB_OUTPUT
echo "apis=${{ github.event.inputs.apis }}" >> $GITHUB_OUTPUT
echo "unity_version=${{ github.event.inputs.unity_version }}" >> $GITHUB_OUTPUT
echo "should_trigger_package=${{ github.event.inputs.should_trigger_package }}" >> $GITHUB_OUTPUT
echo "runIntegrationTests=${{ github.event.inputs.runIntegrationTests }}" >> $GITHUB_OUTPUT
echo "firebase_cpp_sdk_version=${{ github.event.inputs.firebase_cpp_sdk_version }}" >> $GITHUB_OUTPUT
echo "unity_branch=${{ github.event.inputs.unity_branch }}" >> $GITHUB_OUTPUT
echo "additional_cmake_flags=${{ github.event.inputs.unity_branch }}" >> $GITHUB_OUTPUT
else
echo "platform='Android,iOS,tvOS,Windows,macOS,Linux,Playmode'" >> $GITHUB_OUTPUT
echo "release_label=nightly-$(date "+%Y%m%d-%H%M%S")" >> $GITHUB_OUTPUT
echo "release_version=NoVersion" >> $GITHUB_OUTPUT
echo "apis='analytics,app_check,auth,crashlytics,database,dynamic_links,firestore,functions,installations,messaging,remote_config,storage'" >> $GITHUB_OUTPUT
echo "unity_version=2021" >> $GITHUB_OUTPUT
echo "should_trigger_package=true" >> $GITHUB_OUTPUT
echo "firebase_cpp_sdk_version=" >> $GITHUB_OUTPUT
echo "unity_branch=" >> $GITHUB_OUTPUT
echo "additional_cmake_flags=" >> $GITHUB_OUTPUT
if [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "runIntegrationTests=nightly-packaging" >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
if [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested: quick" ]]; then
echo "runIntegrationTests=${{ github.event.pull_request.number }}:label-quick-packaging" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.action }}" == "labeled" && "${{ github.event.label.name }}" == "tests-requested: full" ]]; then
echo "runIntegrationTests=${{ github.event.pull_request.number }}:label-full-packaging" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged == true}}" == "true" ]]; then
echo "runIntegrationTests=${{ github.event.pull_request.number }}:pr-close-packaging" >> $GITHUB_OUTPUT
else
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
fi
else
echo "invalid_trigger=1" >> $GITHUB_OUTPUT
fi
fi
- name: Cancel workflow
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
uses: andymckay/[email protected]
- name: Wait for workflow cancellation
if: ${{ steps.set_outputs.outputs.invalid_trigger }}
run: |
sleep 300
exit 1 # fail out if the cancellation above somehow failed.
- name: Print output
run: |
echo outputs.platform : ${{ steps.set_outputs.outputs.platform }}
echo outputs.release_label : ${{ steps.set_outputs.outputs.release_label }}
echo outputs.release_version : ${{ steps.set_outputs.outputs.release_version }}
echo outputs.apis : ${{ steps.set_outputs.outputs.apis }}
echo outputs.unity_version : ${{ steps.set_outputs.outputs.unity_version }}
echo outputs.should_trigger_package : ${{ steps.set_outputs.outputs.should_trigger_package }}
echo outputs.runIntegrationTests : ${{ steps.set_outputs.outputs.runIntegrationTests }}
echo outputs.firebase_cpp_sdk_version : ${{ steps.set_outputs.outputs.firebase_cpp_sdk_version }}
echo outputs.unity_branch : ${{ steps.set_outputs.outputs.unity_branch }}
echo outputs.additional_cmake_flags : ${{ steps.set_outputs.outputs.additional_cmake_flags }}
update_versions:
uses: ./.github/workflows/update_versions.yml
needs: check_and_prepare
if: (needs.check_and_prepare.outputs.release_version!='NoVersion')
with:
triggered_by_callable: true
base_branch: ${{ needs.check_and_prepare.outputs.unity_branch }}
package_version_number: ${{ needs.check_and_prepare.outputs.release_version }}
cpp_release_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
secrets: inherit
decide_build_branch:
needs: [check_and_prepare,update_versions]
runs-on: ubuntu-latest
if: always()
outputs:
build_branch: ${{ steps.decide_branch.outputs.branch }}
steps:
- id: decide_branch
run: |
if [[ "${{ needs.check_and_prepare.outputs.release_version }}" == "'NoVersion'" ]]; then
# Triggered by callable
echo "branch=${{ needs.check_and_prepare.outputs.unity_branch }}" >> $GITHUB_OUTPUT
else
echo "branch=${{ needs.update_versions.outputs.new_branch }}" >> $GITHUB_OUTPUT
fi
build_android:
name: build-android-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
uses: ./.github/workflows/build_android.yml
needs: [check_and_prepare, decide_build_branch]
if: always() && contains(needs.check_and_prepare.outputs.platform, 'Android')
with:
unity_version: ${{ needs.check_and_prepare.outputs.unity_version }}
firebase_cpp_sdk_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
unity_platform_name: Android
additional_cmake_flags: ${{ needs.check_and_prepare.outputs.additional_cmake_flags }}
build_ios:
name: build-ios-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
uses: ./.github/workflows/build_ios.yml
needs: [check_and_prepare, decide_build_branch]
if: always() && contains(needs.check_and_prepare.outputs.platform, 'iOS')
with:
unity_version: ${{needs.check_and_prepare.outputs.unity_version }}
firebase_cpp_sdk_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
unity_platform_name: iOS
additional_cmake_flags: ${{ needs.check_and_prepare.outputs.additional_cmake_flags }}
build_tvos:
name: build-tvos-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
uses: ./.github/workflows/build_tvos.yml
needs: [check_and_prepare, decide_build_branch]
if: always() && contains(needs.check_and_prepare.outputs.platform, 'tvOS')
with:
unity_version: ${{needs.check_and_prepare.outputs.unity_version }}
firebase_cpp_sdk_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
unity_platform_name: 'tvOS,iOS'
build_linux:
name: build-linux-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
uses: ./.github/workflows/build_linux.yml
needs: [check_and_prepare, decide_build_branch]
if: always() && contains(needs.check_and_prepare.outputs.platform, 'Linux')
with:
unity_version: ${{ needs.check_and_prepare.outputs.unity_version }}
firebase_cpp_sdk_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
unity_platform_name: Linux
additional_cmake_flags: ${{ needs.check_and_prepare.outputs.additional_cmake_flags }}
build_macos:
name: build-macos-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
uses: ./.github/workflows/build_macos.yml
needs: [check_and_prepare, decide_build_branch]
if: always() && contains(needs.check_and_prepare.outputs.platform, 'macOS')
with:
unity_version: ${{ needs.check_and_prepare.outputs.unity_version }}
firebase_cpp_sdk_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
unity_platform_name: macOS,iOS
additional_cmake_flags: ${{ needs.check_and_prepare.outputs.additional_cmake_flags }}
build_windows:
name: build-windows-unity${{ needs.check_and_prepare.outputs.unity_version }}-CPP${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
uses: ./.github/workflows/build_windows.yml
needs: [check_and_prepare, decide_build_branch]
if: always() && contains(needs.check_and_prepare.outputs.platform, 'Windows')
with:
unity_version: ${{ needs.check_and_prepare.outputs.unity_version }}
firebase_cpp_sdk_version: ${{ needs.check_and_prepare.outputs.firebase_cpp_sdk_version }}
unity_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
unity_platform_name: Windows
additional_cmake_flags: ${{ needs.check_and_prepare.outputs.additional_cmake_flags }}
trigger_reusable_package:
name: package ${{ needs.check_and_prepare.outputs.release_label }}
needs: [check_and_prepare, build_android, build_ios, build_tvos, build_linux, build_macos, build_windows, decide_build_branch]
uses: ./.github/workflows/package.yml
if: (needs.check_and_prepare.outputs.should_trigger_package == 'true') && !cancelled() && !failure()
with:
release_label: ${{ needs.check_and_prepare.outputs.release_label }}
runIntegrationTests: ${{ needs.check_and_prepare.outputs.runIntegrationTests }}
build_run_id: ${{ github.run_id }}
working_branch: ${{ needs.decide_build_branch.outputs.build_branch }}
platforms: ${{ needs.check_and_prepare.outputs.platform }}
apis: ${{ needs.check_and_prepare.outputs.apis }}
secrets: inherit